﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace Maticsoft.DAL
{
    /// <summary>
    /// 数据访问类:Inventory
    /// </summary>
    public partial class Inventory
    {
        public Inventory()
        { }
        #region  BasicMethod
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string cInvCode)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from Inventory");
            strSql.Append(" where cInvCode=@cInvCode ");
            SqlParameter[] parameters = {
                    new SqlParameter("@cInvCode", SqlDbType.NVarChar,60)            };
            parameters[0].Value = cInvCode;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.Inventory model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into Inventory(");
            strSql.Append("cInvCode,cInvAddCode,cInvName,cInvStd,cInvCCode,cVenCode,cReplaceItem,cPosition,bSale,bPurchase,bSelf,bComsume,bProducing,bService,bAccessary,iTaxRate,iInvWeight,iVolume,iInvRCost,iInvSPrice,iInvSCost,iInvLSCost,iInvNCost,iInvAdvance,iInvBatch,iSafeNum,iTopSum,iLowSum,iOverStock,cInvABC,bInvQuality,bInvBatch,bInvEntrust,bInvOverStock,dSDate,dEDate,bFree1,bFree2,cInvDefine1,cInvDefine2,cInvDefine3,bInvType,iInvMPCost,cQuality,iInvSaleCost,iInvSCost1,iInvSCost2,iInvSCost3,bFree3,bFree4,bFree5,bFree6,bFree7,bFree8,bFree9,bFree10,cCreatePerson,cModifyPerson,dModifyDate,fSubscribePoint,fVagQuantity,cValueType,bFixExch,fOutExcess,fInExcess,iMassDate,iWarnDays,fExpensesExch,bTrack,bSerial,bBarCode,iId,cBarCode,cInvDefine4,cInvDefine5,cInvDefine6,cInvDefine7,cInvDefine8,cInvDefine9,cInvDefine10,cInvDefine11,cInvDefine12,cInvDefine13,cInvDefine14,cInvDefine15,cInvDefine16,iGroupType,cGroupCode,cComUnitCode,cAssComUnitCode,cSAComUnitCode,cPUComUnitCode,cSTComUnitCode,cCAComUnitCode,cFrequency,iFrequency,iDays,dLastDate,iWastage,bSolitude,cEnterprise,cAddress,cFile,cLabel,cCheckOut,cLicence,bSpecialties,cDefWareHouse,iHighPrice,iExpSaleRate,cPriceGroup,cOfferGrade,iOfferRate,cMonth,iAdvanceDate,cCurrencyName,cProduceAddress,cProduceNation,cRegisterNo,cEnterNo,cPackingType,cEnglishName,bPropertyCheck,cPreparationType,cCommodity,iRecipeBatch,cNotPatentName,bPromotSales,iPlanPolicy,iROPMethod,iBatchRule,fBatchIncrement,iAssureProvideDays,iTestStyle,iDTMethod,fDTRate,fDTNum,cDTUnit,iDTStyle,iQTMethod,PictureGUID,bPlanInv,bProxyForeign,bATOModel,bCheckItem,bPTOModel,bEquipment,cProductUnit,fOrderUpLimit,cMassUnit,fRetailPrice,cInvDepCode,iAlterAdvance,fAlterBaseNum,cPlanMethod,bMPS,bROP,bRePlan,cSRPolicy,bBillUnite,iSupplyDay,fSupplyMulti,fMinSupply,bCutMantissa,cInvPersonCode,iInvTfId,cEngineerFigNo,bInTotalCost,iSupplyType,bConfigFree1,bConfigFree2,bConfigFree3,bConfigFree4,bConfigFree5,bConfigFree6,bConfigFree7,bConfigFree8,bConfigFree9,bConfigFree10,iDTLevel,cDTAQL,bPeriodDT,cDTPeriod,iBigMonth,iBigDay,iSmallMonth,iSmallDay,bOutInvDT,bBackInvDT,iEndDTStyle,bDTWarnInv,fBackTaxRate,cCIQCode,cWGroupCode,cWUnit,fGrossW,cVGroupCode,cVUnit,fLength,fWidth,fHeight,iDTUCounter,iDTDCounter,iBatchCounter,cShopUnit,cPurPersonCode,bImportMedicine,bFirstBusiMedicine,bForeExpland,cInvPlanCode,fConvertRate,dReplaceDate,bInvModel,bKCCutMantissa,bReceiptByDT,iImpTaxRate,iExpTaxRate,bExpSale,iDrawBatch,bCheckBSATP,cInvProjectCode,iTestRule,cRuleCode,bCheckFree1,bCheckFree2,bCheckFree3,bCheckFree4,bCheckFree5,bCheckFree6,bCheckFree7,bCheckFree8,bCheckFree9,bCheckFree10,bBomMain,bBomSub,bProductBill,iCheckATP,iInvATPId,iPlanTfDay,iOverlapDay,bPiece,bSrvItem,bSrvFittings,fMaxSupply,fMinSplit,bSpecialOrder,bTrackSaleBill,cInvMnemCode)");
            strSql.Append(" values (");
            strSql.Append("@cInvCode,@cInvAddCode,@cInvName,@cInvStd,@cInvCCode,@cVenCode,@cReplaceItem,@cPosition,@bSale,@bPurchase,@bSelf,@bComsume,@bProducing,@bService,@bAccessary,@iTaxRate,@iInvWeight,@iVolume,@iInvRCost,@iInvSPrice,@iInvSCost,@iInvLSCost,@iInvNCost,@iInvAdvance,@iInvBatch,@iSafeNum,@iTopSum,@iLowSum,@iOverStock,@cInvABC,@bInvQuality,@bInvBatch,@bInvEntrust,@bInvOverStock,@dSDate,@dEDate,@bFree1,@bFree2,@cInvDefine1,@cInvDefine2,@cInvDefine3,@bInvType,@iInvMPCost,@cQuality,@iInvSaleCost,@iInvSCost1,@iInvSCost2,@iInvSCost3,@bFree3,@bFree4,@bFree5,@bFree6,@bFree7,@bFree8,@bFree9,@bFree10,@cCreatePerson,@cModifyPerson,@dModifyDate,@fSubscribePoint,@fVagQuantity,@cValueType,@bFixExch,@fOutExcess,@fInExcess,@iMassDate,@iWarnDays,@fExpensesExch,@bTrack,@bSerial,@bBarCode,@iId,@cBarCode,@cInvDefine4,@cInvDefine5,@cInvDefine6,@cInvDefine7,@cInvDefine8,@cInvDefine9,@cInvDefine10,@cInvDefine11,@cInvDefine12,@cInvDefine13,@cInvDefine14,@cInvDefine15,@cInvDefine16,@iGroupType,@cGroupCode,@cComUnitCode,@cAssComUnitCode,@cSAComUnitCode,@cPUComUnitCode,@cSTComUnitCode,@cCAComUnitCode,@cFrequency,@iFrequency,@iDays,@dLastDate,@iWastage,@bSolitude,@cEnterprise,@cAddress,@cFile,@cLabel,@cCheckOut,@cLicence,@bSpecialties,@cDefWareHouse,@iHighPrice,@iExpSaleRate,@cPriceGroup,@cOfferGrade,@iOfferRate,@cMonth,@iAdvanceDate,@cCurrencyName,@cProduceAddress,@cProduceNation,@cRegisterNo,@cEnterNo,@cPackingType,@cEnglishName,@bPropertyCheck,@cPreparationType,@cCommodity,@iRecipeBatch,@cNotPatentName,@bPromotSales,@iPlanPolicy,@iROPMethod,@iBatchRule,@fBatchIncrement,@iAssureProvideDays,@iTestStyle,@iDTMethod,@fDTRate,@fDTNum,@cDTUnit,@iDTStyle,@iQTMethod,@PictureGUID,@bPlanInv,@bProxyForeign,@bATOModel,@bCheckItem,@bPTOModel,@bEquipment,@cProductUnit,@fOrderUpLimit,@cMassUnit,@fRetailPrice,@cInvDepCode,@iAlterAdvance,@fAlterBaseNum,@cPlanMethod,@bMPS,@bROP,@bRePlan,@cSRPolicy,@bBillUnite,@iSupplyDay,@fSupplyMulti,@fMinSupply,@bCutMantissa,@cInvPersonCode,@iInvTfId,@cEngineerFigNo,@bInTotalCost,@iSupplyType,@bConfigFree1,@bConfigFree2,@bConfigFree3,@bConfigFree4,@bConfigFree5,@bConfigFree6,@bConfigFree7,@bConfigFree8,@bConfigFree9,@bConfigFree10,@iDTLevel,@cDTAQL,@bPeriodDT,@cDTPeriod,@iBigMonth,@iBigDay,@iSmallMonth,@iSmallDay,@bOutInvDT,@bBackInvDT,@iEndDTStyle,@bDTWarnInv,@fBackTaxRate,@cCIQCode,@cWGroupCode,@cWUnit,@fGrossW,@cVGroupCode,@cVUnit,@fLength,@fWidth,@fHeight,@iDTUCounter,@iDTDCounter,@iBatchCounter,@cShopUnit,@cPurPersonCode,@bImportMedicine,@bFirstBusiMedicine,@bForeExpland,@cInvPlanCode,@fConvertRate,@dReplaceDate,@bInvModel,@bKCCutMantissa,@bReceiptByDT,@iImpTaxRate,@iExpTaxRate,@bExpSale,@iDrawBatch,@bCheckBSATP,@cInvProjectCode,@iTestRule,@cRuleCode,@bCheckFree1,@bCheckFree2,@bCheckFree3,@bCheckFree4,@bCheckFree5,@bCheckFree6,@bCheckFree7,@bCheckFree8,@bCheckFree9,@bCheckFree10,@bBomMain,@bBomSub,@bProductBill,@iCheckATP,@iInvATPId,@iPlanTfDay,@iOverlapDay,@bPiece,@bSrvItem,@bSrvFittings,@fMaxSupply,@fMinSplit,@bSpecialOrder,@bTrackSaleBill,@cInvMnemCode)");
            SqlParameter[] parameters = {
                    new SqlParameter("@cInvCode", SqlDbType.NVarChar,60),
                    new SqlParameter("@cInvAddCode", SqlDbType.NVarChar,255),
                    new SqlParameter("@cInvName", SqlDbType.NVarChar,255),
                    new SqlParameter("@cInvStd", SqlDbType.NVarChar,255),
                    new SqlParameter("@cInvCCode", SqlDbType.NVarChar,12),
                    new SqlParameter("@cVenCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@cReplaceItem", SqlDbType.NVarChar,60),
                    new SqlParameter("@cPosition", SqlDbType.NVarChar,20),
                    new SqlParameter("@bSale", SqlDbType.Bit,1),
                    new SqlParameter("@bPurchase", SqlDbType.Bit,1),
                    new SqlParameter("@bSelf", SqlDbType.Bit,1),
                    new SqlParameter("@bComsume", SqlDbType.Bit,1),
                    new SqlParameter("@bProducing", SqlDbType.Bit,1),
                    new SqlParameter("@bService", SqlDbType.Bit,1),
                    new SqlParameter("@bAccessary", SqlDbType.Bit,1),
                    new SqlParameter("@iTaxRate", SqlDbType.Float,8),
                    new SqlParameter("@iInvWeight", SqlDbType.Float,8),
                    new SqlParameter("@iVolume", SqlDbType.Float,8),
                    new SqlParameter("@iInvRCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvSPrice", SqlDbType.Float,8),
                    new SqlParameter("@iInvSCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvLSCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvNCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvAdvance", SqlDbType.Float,8),
                    new SqlParameter("@iInvBatch", SqlDbType.Float,8),
                    new SqlParameter("@iSafeNum", SqlDbType.Float,8),
                    new SqlParameter("@iTopSum", SqlDbType.Float,8),
                    new SqlParameter("@iLowSum", SqlDbType.Float,8),
                    new SqlParameter("@iOverStock", SqlDbType.Float,8),
                    new SqlParameter("@cInvABC", SqlDbType.NVarChar,1),
                    new SqlParameter("@bInvQuality", SqlDbType.Bit,1),
                    new SqlParameter("@bInvBatch", SqlDbType.Bit,1),
                    new SqlParameter("@bInvEntrust", SqlDbType.Bit,1),
                    new SqlParameter("@bInvOverStock", SqlDbType.Bit,1),
                    new SqlParameter("@dSDate", SqlDbType.DateTime),
                    new SqlParameter("@dEDate", SqlDbType.DateTime),
                    new SqlParameter("@bFree1", SqlDbType.Bit,1),
                    new SqlParameter("@bFree2", SqlDbType.Bit,1),
                    new SqlParameter("@cInvDefine1", SqlDbType.NVarChar,20),
                    new SqlParameter("@cInvDefine2", SqlDbType.NVarChar,20),
                    new SqlParameter("@cInvDefine3", SqlDbType.NVarChar,20),
                    new SqlParameter("@bInvType", SqlDbType.Bit,1),
                    new SqlParameter("@iInvMPCost", SqlDbType.Float,8),
                    new SqlParameter("@cQuality", SqlDbType.NVarChar,100),
                    new SqlParameter("@iInvSaleCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvSCost1", SqlDbType.Float,8),
                    new SqlParameter("@iInvSCost2", SqlDbType.Float,8),
                    new SqlParameter("@iInvSCost3", SqlDbType.Float,8),
                    new SqlParameter("@bFree3", SqlDbType.Bit,1),
                    new SqlParameter("@bFree4", SqlDbType.Bit,1),
                    new SqlParameter("@bFree5", SqlDbType.Bit,1),
                    new SqlParameter("@bFree6", SqlDbType.Bit,1),
                    new SqlParameter("@bFree7", SqlDbType.Bit,1),
                    new SqlParameter("@bFree8", SqlDbType.Bit,1),
                    new SqlParameter("@bFree9", SqlDbType.Bit,1),
                    new SqlParameter("@bFree10", SqlDbType.Bit,1),
                    new SqlParameter("@cCreatePerson", SqlDbType.NVarChar,20),
                    new SqlParameter("@cModifyPerson", SqlDbType.NVarChar,20),
                    new SqlParameter("@dModifyDate", SqlDbType.DateTime),
                    new SqlParameter("@fSubscribePoint", SqlDbType.Float,8),
                    new SqlParameter("@fVagQuantity", SqlDbType.Float,8),
                    new SqlParameter("@cValueType", SqlDbType.NVarChar,20),
                    new SqlParameter("@bFixExch", SqlDbType.Bit,1),
                    new SqlParameter("@fOutExcess", SqlDbType.Float,8),
                    new SqlParameter("@fInExcess", SqlDbType.Float,8),
                    new SqlParameter("@iMassDate", SqlDbType.SmallInt,2),
                    new SqlParameter("@iWarnDays", SqlDbType.SmallInt,2),
                    new SqlParameter("@fExpensesExch", SqlDbType.Float,8),
                    new SqlParameter("@bTrack", SqlDbType.Bit,1),
                    new SqlParameter("@bSerial", SqlDbType.Bit,1),
                    new SqlParameter("@bBarCode", SqlDbType.Bit,1),
                    new SqlParameter("@iId", SqlDbType.Int,4),
                    new SqlParameter("@cBarCode", SqlDbType.NVarChar,30),
                    new SqlParameter("@cInvDefine4", SqlDbType.NVarChar,60),
                    new SqlParameter("@cInvDefine5", SqlDbType.NVarChar,60),
                    new SqlParameter("@cInvDefine6", SqlDbType.NVarChar,60),
                    new SqlParameter("@cInvDefine7", SqlDbType.NVarChar,120),
                    new SqlParameter("@cInvDefine8", SqlDbType.NVarChar,120),
                    new SqlParameter("@cInvDefine9", SqlDbType.NVarChar,120),
                    new SqlParameter("@cInvDefine10", SqlDbType.NVarChar,120),
                    new SqlParameter("@cInvDefine11", SqlDbType.Int,4),
                    new SqlParameter("@cInvDefine12", SqlDbType.Int,4),
                    new SqlParameter("@cInvDefine13", SqlDbType.Float,8),
                    new SqlParameter("@cInvDefine14", SqlDbType.Float,8),
                    new SqlParameter("@cInvDefine15", SqlDbType.DateTime),
                    new SqlParameter("@cInvDefine16", SqlDbType.DateTime),
                    new SqlParameter("@iGroupType", SqlDbType.TinyInt,1),
                    new SqlParameter("@cGroupCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cAssComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cSAComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cPUComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cSTComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cCAComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cFrequency", SqlDbType.NVarChar,10),
                    new SqlParameter("@iFrequency", SqlDbType.SmallInt,2),
                    new SqlParameter("@iDays", SqlDbType.SmallInt,2),
                    new SqlParameter("@dLastDate", SqlDbType.DateTime),
                    new SqlParameter("@iWastage", SqlDbType.Float,8),
                    new SqlParameter("@bSolitude", SqlDbType.Bit,1),
                    new SqlParameter("@cEnterprise", SqlDbType.NVarChar,100),
                    new SqlParameter("@cAddress", SqlDbType.NVarChar,255),
                    new SqlParameter("@cFile", SqlDbType.NVarChar,40),
                    new SqlParameter("@cLabel", SqlDbType.NVarChar,30),
                    new SqlParameter("@cCheckOut", SqlDbType.NVarChar,30),
                    new SqlParameter("@cLicence", SqlDbType.NVarChar,30),
                    new SqlParameter("@bSpecialties", SqlDbType.Bit,1),
                    new SqlParameter("@cDefWareHouse", SqlDbType.NVarChar,10),
                    new SqlParameter("@iHighPrice", SqlDbType.Float,8),
                    new SqlParameter("@iExpSaleRate", SqlDbType.Float,8),
                    new SqlParameter("@cPriceGroup", SqlDbType.NVarChar,20),
                    new SqlParameter("@cOfferGrade", SqlDbType.NVarChar,20),
                    new SqlParameter("@iOfferRate", SqlDbType.Float,8),
                    new SqlParameter("@cMonth", SqlDbType.NVarChar,6),
                    new SqlParameter("@iAdvanceDate", SqlDbType.SmallInt,2),
                    new SqlParameter("@cCurrencyName", SqlDbType.NVarChar,60),
                    new SqlParameter("@cProduceAddress", SqlDbType.NVarChar,255),
                    new SqlParameter("@cProduceNation", SqlDbType.NVarChar,60),
                    new SqlParameter("@cRegisterNo", SqlDbType.NVarChar,60),
                    new SqlParameter("@cEnterNo", SqlDbType.NVarChar,60),
                    new SqlParameter("@cPackingType", SqlDbType.NVarChar,60),
                    new SqlParameter("@cEnglishName", SqlDbType.NVarChar,100),
                    new SqlParameter("@bPropertyCheck", SqlDbType.Bit,1),
                    new SqlParameter("@cPreparationType", SqlDbType.NVarChar,30),
                    new SqlParameter("@cCommodity", SqlDbType.NVarChar,60),
                    new SqlParameter("@iRecipeBatch", SqlDbType.TinyInt,1),
                    new SqlParameter("@cNotPatentName", SqlDbType.NVarChar,30),
                    new SqlParameter("@bPromotSales", SqlDbType.Bit,1),
                    new SqlParameter("@iPlanPolicy", SqlDbType.SmallInt,2),
                    new SqlParameter("@iROPMethod", SqlDbType.SmallInt,2),
                    new SqlParameter("@iBatchRule", SqlDbType.SmallInt,2),
                    new SqlParameter("@fBatchIncrement", SqlDbType.Float,8),
                    new SqlParameter("@iAssureProvideDays", SqlDbType.Int,4),
                    new SqlParameter("@iTestStyle", SqlDbType.SmallInt,2),
                    new SqlParameter("@iDTMethod", SqlDbType.SmallInt,2),
                    new SqlParameter("@fDTRate", SqlDbType.Float,8),
                    new SqlParameter("@fDTNum", SqlDbType.Float,8),
                    new SqlParameter("@cDTUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@iDTStyle", SqlDbType.SmallInt,2),
                    new SqlParameter("@iQTMethod", SqlDbType.Int,4),
                    new SqlParameter("@PictureGUID", SqlDbType.UniqueIdentifier,16),
                    new SqlParameter("@bPlanInv", SqlDbType.Bit,1),
                    new SqlParameter("@bProxyForeign", SqlDbType.Bit,1),
                    new SqlParameter("@bATOModel", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckItem", SqlDbType.Bit,1),
                    new SqlParameter("@bPTOModel", SqlDbType.Bit,1),
                    new SqlParameter("@bEquipment", SqlDbType.Bit,1),
                    new SqlParameter("@cProductUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@fOrderUpLimit", SqlDbType.Float,8),
                    new SqlParameter("@cMassUnit", SqlDbType.SmallInt,2),
                    new SqlParameter("@fRetailPrice", SqlDbType.Float,8),
                    new SqlParameter("@cInvDepCode", SqlDbType.NVarChar,12),
                    new SqlParameter("@iAlterAdvance", SqlDbType.Int,4),
                    new SqlParameter("@fAlterBaseNum", SqlDbType.Float,8),
                    new SqlParameter("@cPlanMethod", SqlDbType.NVarChar,1),
                    new SqlParameter("@bMPS", SqlDbType.Bit,1),
                    new SqlParameter("@bROP", SqlDbType.Bit,1),
                    new SqlParameter("@bRePlan", SqlDbType.Bit,1),
                    new SqlParameter("@cSRPolicy", SqlDbType.NVarChar,2),
                    new SqlParameter("@bBillUnite", SqlDbType.Bit,1),
                    new SqlParameter("@iSupplyDay", SqlDbType.Int,4),
                    new SqlParameter("@fSupplyMulti", SqlDbType.Float,8),
                    new SqlParameter("@fMinSupply", SqlDbType.Float,8),
                    new SqlParameter("@bCutMantissa", SqlDbType.Bit,1),
                    new SqlParameter("@cInvPersonCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@iInvTfId", SqlDbType.Int,4),
                    new SqlParameter("@cEngineerFigNo", SqlDbType.NVarChar,60),
                    new SqlParameter("@bInTotalCost", SqlDbType.Bit,1),
                    new SqlParameter("@iSupplyType", SqlDbType.SmallInt,2),
                    new SqlParameter("@bConfigFree1", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree2", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree3", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree4", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree5", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree6", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree7", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree8", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree9", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree10", SqlDbType.Bit,1),
                    new SqlParameter("@iDTLevel", SqlDbType.SmallInt,2),
                    new SqlParameter("@cDTAQL", SqlDbType.NVarChar,20),
                    new SqlParameter("@bPeriodDT", SqlDbType.Bit,1),
                    new SqlParameter("@cDTPeriod", SqlDbType.NVarChar,30),
                    new SqlParameter("@iBigMonth", SqlDbType.Int,4),
                    new SqlParameter("@iBigDay", SqlDbType.Int,4),
                    new SqlParameter("@iSmallMonth", SqlDbType.Int,4),
                    new SqlParameter("@iSmallDay", SqlDbType.Int,4),
                    new SqlParameter("@bOutInvDT", SqlDbType.Bit,1),
                    new SqlParameter("@bBackInvDT", SqlDbType.Bit,1),
                    new SqlParameter("@iEndDTStyle", SqlDbType.SmallInt,2),
                    new SqlParameter("@bDTWarnInv", SqlDbType.Bit,1),
                    new SqlParameter("@fBackTaxRate", SqlDbType.Float,8),
                    new SqlParameter("@cCIQCode", SqlDbType.NVarChar,30),
                    new SqlParameter("@cWGroupCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cWUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@fGrossW", SqlDbType.Float,8),
                    new SqlParameter("@cVGroupCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cVUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@fLength", SqlDbType.Float,8),
                    new SqlParameter("@fWidth", SqlDbType.Float,8),
                    new SqlParameter("@fHeight", SqlDbType.Float,8),
                    new SqlParameter("@iDTUCounter", SqlDbType.Int,4),
                    new SqlParameter("@iDTDCounter", SqlDbType.Int,4),
                    new SqlParameter("@iBatchCounter", SqlDbType.Int,4),
                    new SqlParameter("@cShopUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@cPurPersonCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@bImportMedicine", SqlDbType.Bit,1),
                    new SqlParameter("@bFirstBusiMedicine", SqlDbType.Bit,1),
                    new SqlParameter("@bForeExpland", SqlDbType.Bit,1),
                    new SqlParameter("@cInvPlanCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@fConvertRate", SqlDbType.Float,8),
                    new SqlParameter("@dReplaceDate", SqlDbType.DateTime),
                    new SqlParameter("@bInvModel", SqlDbType.Bit,1),
                    new SqlParameter("@bKCCutMantissa", SqlDbType.Bit,1),
                    new SqlParameter("@bReceiptByDT", SqlDbType.Bit,1),
                    new SqlParameter("@iImpTaxRate", SqlDbType.Float,8),
                    new SqlParameter("@iExpTaxRate", SqlDbType.Float,8),
                    new SqlParameter("@bExpSale", SqlDbType.Bit,1),
                    new SqlParameter("@iDrawBatch", SqlDbType.Float,8),
                    new SqlParameter("@bCheckBSATP", SqlDbType.Bit,1),
                    new SqlParameter("@cInvProjectCode", SqlDbType.NVarChar,16),
                    new SqlParameter("@iTestRule", SqlDbType.SmallInt,2),
                    new SqlParameter("@cRuleCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@bCheckFree1", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree2", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree3", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree4", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree5", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree6", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree7", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree8", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree9", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree10", SqlDbType.Bit,1),
                    new SqlParameter("@bBomMain", SqlDbType.Bit,1),
                    new SqlParameter("@bBomSub", SqlDbType.Bit,1),
                    new SqlParameter("@bProductBill", SqlDbType.Bit,1),
                    new SqlParameter("@iCheckATP", SqlDbType.SmallInt,2),
                    new SqlParameter("@iInvATPId", SqlDbType.Int,4),
                    new SqlParameter("@iPlanTfDay", SqlDbType.Int,4),
                    new SqlParameter("@iOverlapDay", SqlDbType.Int,4),
                    new SqlParameter("@bPiece", SqlDbType.Bit,1),
                    new SqlParameter("@bSrvItem", SqlDbType.Bit,1),
                    new SqlParameter("@bSrvFittings", SqlDbType.Bit,1),
                    new SqlParameter("@fMaxSupply", SqlDbType.Float,8),
                    new SqlParameter("@fMinSplit", SqlDbType.Float,8),
                    new SqlParameter("@bSpecialOrder", SqlDbType.Bit,1),
                    new SqlParameter("@bTrackSaleBill", SqlDbType.Bit,1),
                    new SqlParameter("@cInvMnemCode", SqlDbType.NVarChar,40)};
            parameters[0].Value = model.cInvCode;
            parameters[1].Value = model.cInvAddCode;
            parameters[2].Value = model.cInvName;
            parameters[3].Value = model.cInvStd;
            parameters[4].Value = model.cInvCCode;
            parameters[5].Value = model.cVenCode;
            parameters[6].Value = model.cReplaceItem;
            parameters[7].Value = model.cPosition;
            parameters[8].Value = model.bSale;
            parameters[9].Value = model.bPurchase;
            parameters[10].Value = model.bSelf;
            parameters[11].Value = model.bComsume;
            parameters[12].Value = model.bProducing;
            parameters[13].Value = model.bService;
            parameters[14].Value = model.bAccessary;
            parameters[15].Value = model.iTaxRate;
            parameters[16].Value = model.iInvWeight;
            parameters[17].Value = model.iVolume;
            parameters[18].Value = model.iInvRCost;
            parameters[19].Value = model.iInvSPrice;
            parameters[20].Value = model.iInvSCost;
            parameters[21].Value = model.iInvLSCost;
            parameters[22].Value = model.iInvNCost;
            parameters[23].Value = model.iInvAdvance;
            parameters[24].Value = model.iInvBatch;
            parameters[25].Value = model.iSafeNum;
            parameters[26].Value = model.iTopSum;
            parameters[27].Value = model.iLowSum;
            parameters[28].Value = model.iOverStock;
            parameters[29].Value = model.cInvABC;
            parameters[30].Value = model.bInvQuality;
            parameters[31].Value = model.bInvBatch;
            parameters[32].Value = model.bInvEntrust;
            parameters[33].Value = model.bInvOverStock;
            parameters[34].Value = model.dSDate;
            parameters[35].Value = model.dEDate;
            parameters[36].Value = model.bFree1;
            parameters[37].Value = model.bFree2;
            parameters[38].Value = model.cInvDefine1;
            parameters[39].Value = model.cInvDefine2;
            parameters[40].Value = model.cInvDefine3;
            parameters[41].Value = model.bInvType;
            parameters[42].Value = model.iInvMPCost;
            parameters[43].Value = model.cQuality;
            parameters[44].Value = model.iInvSaleCost;
            parameters[45].Value = model.iInvSCost1;
            parameters[46].Value = model.iInvSCost2;
            parameters[47].Value = model.iInvSCost3;
            parameters[48].Value = model.bFree3;
            parameters[49].Value = model.bFree4;
            parameters[50].Value = model.bFree5;
            parameters[51].Value = model.bFree6;
            parameters[52].Value = model.bFree7;
            parameters[53].Value = model.bFree8;
            parameters[54].Value = model.bFree9;
            parameters[55].Value = model.bFree10;
            parameters[56].Value = model.cCreatePerson;
            parameters[57].Value = model.cModifyPerson;
            parameters[58].Value = model.dModifyDate;
            parameters[59].Value = model.fSubscribePoint;
            parameters[60].Value = model.fVagQuantity;
            parameters[61].Value = model.cValueType;
            parameters[62].Value = model.bFixExch;
            parameters[63].Value = model.fOutExcess;
            parameters[64].Value = model.fInExcess;
            parameters[65].Value = model.iMassDate;
            parameters[66].Value = model.iWarnDays;
            parameters[67].Value = model.fExpensesExch;
            parameters[68].Value = model.bTrack;
            parameters[69].Value = model.bSerial;
            parameters[70].Value = model.bBarCode;
            parameters[71].Value = model.iId;
            parameters[72].Value = model.cBarCode;
            parameters[73].Value = model.cInvDefine4;
            parameters[74].Value = model.cInvDefine5;
            parameters[75].Value = model.cInvDefine6;
            parameters[76].Value = model.cInvDefine7;
            parameters[77].Value = model.cInvDefine8;
            parameters[78].Value = model.cInvDefine9;
            parameters[79].Value = model.cInvDefine10;
            parameters[80].Value = model.cInvDefine11;
            parameters[81].Value = model.cInvDefine12;
            parameters[82].Value = model.cInvDefine13;
            parameters[83].Value = model.cInvDefine14;
            parameters[84].Value = model.cInvDefine15;
            parameters[85].Value = model.cInvDefine16;
            parameters[86].Value = model.iGroupType;
            parameters[87].Value = model.cGroupCode;
            parameters[88].Value = model.cComUnitCode;
            parameters[89].Value = model.cAssComUnitCode;
            parameters[90].Value = model.cSAComUnitCode;
            parameters[91].Value = model.cPUComUnitCode;
            parameters[92].Value = model.cSTComUnitCode;
            parameters[93].Value = model.cCAComUnitCode;
            parameters[94].Value = model.cFrequency;
            parameters[95].Value = model.iFrequency;
            parameters[96].Value = model.iDays;
            parameters[97].Value = model.dLastDate;
            parameters[98].Value = model.iWastage;
            parameters[99].Value = model.bSolitude;
            parameters[100].Value = model.cEnterprise;
            parameters[101].Value = model.cAddress;
            parameters[102].Value = model.cFile;
            parameters[103].Value = model.cLabel;
            parameters[104].Value = model.cCheckOut;
            parameters[105].Value = model.cLicence;
            parameters[106].Value = model.bSpecialties;
            parameters[107].Value = model.cDefWareHouse;
            parameters[108].Value = model.iHighPrice;
            parameters[109].Value = model.iExpSaleRate;
            parameters[110].Value = model.cPriceGroup;
            parameters[111].Value = model.cOfferGrade;
            parameters[112].Value = model.iOfferRate;
            parameters[113].Value = model.cMonth;
            parameters[114].Value = model.iAdvanceDate;
            parameters[115].Value = model.cCurrencyName;
            parameters[116].Value = model.cProduceAddress;
            parameters[117].Value = model.cProduceNation;
            parameters[118].Value = model.cRegisterNo;
            parameters[119].Value = model.cEnterNo;
            parameters[120].Value = model.cPackingType;
            parameters[121].Value = model.cEnglishName;
            parameters[122].Value = model.bPropertyCheck;
            parameters[123].Value = model.cPreparationType;
            parameters[124].Value = model.cCommodity;
            parameters[125].Value = model.iRecipeBatch;
            parameters[126].Value = model.cNotPatentName;
            parameters[127].Value = model.bPromotSales;
            parameters[128].Value = model.iPlanPolicy;
            parameters[129].Value = model.iROPMethod;
            parameters[130].Value = model.iBatchRule;
            parameters[131].Value = model.fBatchIncrement;
            parameters[132].Value = model.iAssureProvideDays;
            parameters[133].Value = model.iTestStyle;
            parameters[134].Value = model.iDTMethod;
            parameters[135].Value = model.fDTRate;
            parameters[136].Value = model.fDTNum;
            parameters[137].Value = model.cDTUnit;
            parameters[138].Value = model.iDTStyle;
            parameters[139].Value = model.iQTMethod;
            parameters[140].Value = Guid.NewGuid();
            parameters[141].Value = model.bPlanInv;
            parameters[142].Value = model.bProxyForeign;
            parameters[143].Value = model.bATOModel;
            parameters[144].Value = model.bCheckItem;
            parameters[145].Value = model.bPTOModel;
            parameters[146].Value = model.bEquipment;
            parameters[147].Value = model.cProductUnit;
            parameters[148].Value = model.fOrderUpLimit;
            parameters[149].Value = model.cMassUnit;
            parameters[150].Value = model.fRetailPrice;
            parameters[151].Value = model.cInvDepCode;
            parameters[152].Value = model.iAlterAdvance;
            parameters[153].Value = model.fAlterBaseNum;
            parameters[154].Value = model.cPlanMethod;
            parameters[155].Value = model.bMPS;
            parameters[156].Value = model.bROP;
            parameters[157].Value = model.bRePlan;
            parameters[158].Value = model.cSRPolicy;
            parameters[159].Value = model.bBillUnite;
            parameters[160].Value = model.iSupplyDay;
            parameters[161].Value = model.fSupplyMulti;
            parameters[162].Value = model.fMinSupply;
            parameters[163].Value = model.bCutMantissa;
            parameters[164].Value = model.cInvPersonCode;
            parameters[165].Value = model.iInvTfId;
            parameters[166].Value = model.cEngineerFigNo;
            parameters[167].Value = model.bInTotalCost;
            parameters[168].Value = model.iSupplyType;
            parameters[169].Value = model.bConfigFree1;
            parameters[170].Value = model.bConfigFree2;
            parameters[171].Value = model.bConfigFree3;
            parameters[172].Value = model.bConfigFree4;
            parameters[173].Value = model.bConfigFree5;
            parameters[174].Value = model.bConfigFree6;
            parameters[175].Value = model.bConfigFree7;
            parameters[176].Value = model.bConfigFree8;
            parameters[177].Value = model.bConfigFree9;
            parameters[178].Value = model.bConfigFree10;
            parameters[179].Value = model.iDTLevel;
            parameters[180].Value = model.cDTAQL;
            parameters[181].Value = model.bPeriodDT;
            parameters[182].Value = model.cDTPeriod;
            parameters[183].Value = model.iBigMonth;
            parameters[184].Value = model.iBigDay;
            parameters[185].Value = model.iSmallMonth;
            parameters[186].Value = model.iSmallDay;
            parameters[187].Value = model.bOutInvDT;
            parameters[188].Value = model.bBackInvDT;
            parameters[189].Value = model.iEndDTStyle;
            parameters[190].Value = model.bDTWarnInv;
            parameters[191].Value = model.fBackTaxRate;
            parameters[192].Value = model.cCIQCode;
            parameters[193].Value = model.cWGroupCode;
            parameters[194].Value = model.cWUnit;
            parameters[195].Value = model.fGrossW;
            parameters[196].Value = model.cVGroupCode;
            parameters[197].Value = model.cVUnit;
            parameters[198].Value = model.fLength;
            parameters[199].Value = model.fWidth;
            parameters[200].Value = model.fHeight;
            parameters[201].Value = model.iDTUCounter;
            parameters[202].Value = model.iDTDCounter;
            parameters[203].Value = model.iBatchCounter;
            parameters[204].Value = model.cShopUnit;
            parameters[205].Value = model.cPurPersonCode;
            parameters[206].Value = model.bImportMedicine;
            parameters[207].Value = model.bFirstBusiMedicine;
            parameters[208].Value = model.bForeExpland;
            parameters[209].Value = model.cInvPlanCode;
            parameters[210].Value = model.fConvertRate;
            parameters[211].Value = model.dReplaceDate;
            parameters[212].Value = model.bInvModel;
            parameters[213].Value = model.bKCCutMantissa;
            parameters[214].Value = model.bReceiptByDT;
            parameters[215].Value = model.iImpTaxRate;
            parameters[216].Value = model.iExpTaxRate;
            parameters[217].Value = model.bExpSale;
            parameters[218].Value = model.iDrawBatch;
            parameters[219].Value = model.bCheckBSATP;
            parameters[220].Value = model.cInvProjectCode;
            parameters[221].Value = model.iTestRule;
            parameters[222].Value = model.cRuleCode;
            parameters[223].Value = model.bCheckFree1;
            parameters[224].Value = model.bCheckFree2;
            parameters[225].Value = model.bCheckFree3;
            parameters[226].Value = model.bCheckFree4;
            parameters[227].Value = model.bCheckFree5;
            parameters[228].Value = model.bCheckFree6;
            parameters[229].Value = model.bCheckFree7;
            parameters[230].Value = model.bCheckFree8;
            parameters[231].Value = model.bCheckFree9;
            parameters[232].Value = model.bCheckFree10;
            parameters[233].Value = model.bBomMain;
            parameters[234].Value = model.bBomSub;
            parameters[235].Value = model.bProductBill;
            parameters[236].Value = model.iCheckATP;
            parameters[237].Value = model.iInvATPId;
            parameters[238].Value = model.iPlanTfDay;
            parameters[239].Value = model.iOverlapDay;
            parameters[240].Value = model.bPiece;
            parameters[241].Value = model.bSrvItem;
            parameters[242].Value = model.bSrvFittings;
            parameters[243].Value = model.fMaxSupply;
            parameters[244].Value = model.fMinSplit;
            parameters[245].Value = model.bSpecialOrder;
            parameters[246].Value = model.bTrackSaleBill;
            parameters[247].Value = model.cInvMnemCode;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Inventory model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update Inventory set ");
            strSql.Append("cInvAddCode=@cInvAddCode,");
            strSql.Append("cInvName=@cInvName,");
            strSql.Append("cInvStd=@cInvStd,");
            strSql.Append("cInvCCode=@cInvCCode,");
            strSql.Append("cVenCode=@cVenCode,");
            strSql.Append("cReplaceItem=@cReplaceItem,");
            strSql.Append("cPosition=@cPosition,");
            strSql.Append("bSale=@bSale,");
            strSql.Append("bPurchase=@bPurchase,");
            strSql.Append("bSelf=@bSelf,");
            strSql.Append("bComsume=@bComsume,");
            strSql.Append("bProducing=@bProducing,");
            strSql.Append("bService=@bService,");
            strSql.Append("bAccessary=@bAccessary,");
            strSql.Append("iTaxRate=@iTaxRate,");
            strSql.Append("iInvWeight=@iInvWeight,");
            strSql.Append("iVolume=@iVolume,");
            strSql.Append("iInvRCost=@iInvRCost,");
            strSql.Append("iInvSPrice=@iInvSPrice,");
            strSql.Append("iInvSCost=@iInvSCost,");
            strSql.Append("iInvLSCost=@iInvLSCost,");
            strSql.Append("iInvNCost=@iInvNCost,");
            strSql.Append("iInvAdvance=@iInvAdvance,");
            strSql.Append("iInvBatch=@iInvBatch,");
            strSql.Append("iSafeNum=@iSafeNum,");
            strSql.Append("iTopSum=@iTopSum,");
            strSql.Append("iLowSum=@iLowSum,");
            strSql.Append("iOverStock=@iOverStock,");
            strSql.Append("cInvABC=@cInvABC,");
            strSql.Append("bInvQuality=@bInvQuality,");
            strSql.Append("bInvBatch=@bInvBatch,");
            strSql.Append("bInvEntrust=@bInvEntrust,");
            strSql.Append("bInvOverStock=@bInvOverStock,");
            strSql.Append("dSDate=@dSDate,");
            strSql.Append("dEDate=@dEDate,");
            strSql.Append("bFree1=@bFree1,");
            strSql.Append("bFree2=@bFree2,");
            strSql.Append("cInvDefine1=@cInvDefine1,");
            strSql.Append("cInvDefine2=@cInvDefine2,");
            strSql.Append("cInvDefine3=@cInvDefine3,");
            strSql.Append("bInvType=@bInvType,");
            strSql.Append("iInvMPCost=@iInvMPCost,");
            strSql.Append("cQuality=@cQuality,");
            strSql.Append("iInvSaleCost=@iInvSaleCost,");
            strSql.Append("iInvSCost1=@iInvSCost1,");
            strSql.Append("iInvSCost2=@iInvSCost2,");
            strSql.Append("iInvSCost3=@iInvSCost3,");
            strSql.Append("bFree3=@bFree3,");
            strSql.Append("bFree4=@bFree4,");
            strSql.Append("bFree5=@bFree5,");
            strSql.Append("bFree6=@bFree6,");
            strSql.Append("bFree7=@bFree7,");
            strSql.Append("bFree8=@bFree8,");
            strSql.Append("bFree9=@bFree9,");
            strSql.Append("bFree10=@bFree10,");
            strSql.Append("cCreatePerson=@cCreatePerson,");
            strSql.Append("cModifyPerson=@cModifyPerson,");
            strSql.Append("dModifyDate=@dModifyDate,");
            strSql.Append("fSubscribePoint=@fSubscribePoint,");
            strSql.Append("fVagQuantity=@fVagQuantity,");
            strSql.Append("cValueType=@cValueType,");
            strSql.Append("bFixExch=@bFixExch,");
            strSql.Append("fOutExcess=@fOutExcess,");
            strSql.Append("fInExcess=@fInExcess,");
            strSql.Append("iMassDate=@iMassDate,");
            strSql.Append("iWarnDays=@iWarnDays,");
            strSql.Append("fExpensesExch=@fExpensesExch,");
            strSql.Append("bTrack=@bTrack,");
            strSql.Append("bSerial=@bSerial,");
            strSql.Append("bBarCode=@bBarCode,");
            strSql.Append("iId=@iId,");
            strSql.Append("cBarCode=@cBarCode,");
            strSql.Append("cInvDefine4=@cInvDefine4,");
            strSql.Append("cInvDefine5=@cInvDefine5,");
            strSql.Append("cInvDefine6=@cInvDefine6,");
            strSql.Append("cInvDefine7=@cInvDefine7,");
            strSql.Append("cInvDefine8=@cInvDefine8,");
            strSql.Append("cInvDefine9=@cInvDefine9,");
            strSql.Append("cInvDefine10=@cInvDefine10,");
            strSql.Append("cInvDefine11=@cInvDefine11,");
            strSql.Append("cInvDefine12=@cInvDefine12,");
            strSql.Append("cInvDefine13=@cInvDefine13,");
            strSql.Append("cInvDefine14=@cInvDefine14,");
            strSql.Append("cInvDefine15=@cInvDefine15,");
            strSql.Append("cInvDefine16=@cInvDefine16,");
            strSql.Append("iGroupType=@iGroupType,");
            strSql.Append("cGroupCode=@cGroupCode,");
            strSql.Append("cComUnitCode=@cComUnitCode,");
            strSql.Append("cAssComUnitCode=@cAssComUnitCode,");
            strSql.Append("cSAComUnitCode=@cSAComUnitCode,");
            strSql.Append("cPUComUnitCode=@cPUComUnitCode,");
            strSql.Append("cSTComUnitCode=@cSTComUnitCode,");
            strSql.Append("cCAComUnitCode=@cCAComUnitCode,");
            strSql.Append("cFrequency=@cFrequency,");
            strSql.Append("iFrequency=@iFrequency,");
            strSql.Append("iDays=@iDays,");
            strSql.Append("dLastDate=@dLastDate,");
            strSql.Append("iWastage=@iWastage,");
            strSql.Append("bSolitude=@bSolitude,");
            strSql.Append("cEnterprise=@cEnterprise,");
            strSql.Append("cAddress=@cAddress,");
            strSql.Append("cFile=@cFile,");
            strSql.Append("cLabel=@cLabel,");
            strSql.Append("cCheckOut=@cCheckOut,");
            strSql.Append("cLicence=@cLicence,");
            strSql.Append("bSpecialties=@bSpecialties,");
            strSql.Append("cDefWareHouse=@cDefWareHouse,");
            strSql.Append("iHighPrice=@iHighPrice,");
            strSql.Append("iExpSaleRate=@iExpSaleRate,");
            strSql.Append("cPriceGroup=@cPriceGroup,");
            strSql.Append("cOfferGrade=@cOfferGrade,");
            strSql.Append("iOfferRate=@iOfferRate,");
            strSql.Append("cMonth=@cMonth,");
            strSql.Append("iAdvanceDate=@iAdvanceDate,");
            strSql.Append("cCurrencyName=@cCurrencyName,");
            strSql.Append("cProduceAddress=@cProduceAddress,");
            strSql.Append("cProduceNation=@cProduceNation,");
            strSql.Append("cRegisterNo=@cRegisterNo,");
            strSql.Append("cEnterNo=@cEnterNo,");
            strSql.Append("cPackingType=@cPackingType,");
            strSql.Append("cEnglishName=@cEnglishName,");
            strSql.Append("bPropertyCheck=@bPropertyCheck,");
            strSql.Append("cPreparationType=@cPreparationType,");
            strSql.Append("cCommodity=@cCommodity,");
            strSql.Append("iRecipeBatch=@iRecipeBatch,");
            strSql.Append("cNotPatentName=@cNotPatentName,");
            strSql.Append("bPromotSales=@bPromotSales,");
            strSql.Append("iPlanPolicy=@iPlanPolicy,");
            strSql.Append("iROPMethod=@iROPMethod,");
            strSql.Append("iBatchRule=@iBatchRule,");
            strSql.Append("fBatchIncrement=@fBatchIncrement,");
            strSql.Append("iAssureProvideDays=@iAssureProvideDays,");
            strSql.Append("iTestStyle=@iTestStyle,");
            strSql.Append("iDTMethod=@iDTMethod,");
            strSql.Append("fDTRate=@fDTRate,");
            strSql.Append("fDTNum=@fDTNum,");
            strSql.Append("cDTUnit=@cDTUnit,");
            strSql.Append("iDTStyle=@iDTStyle,");
            strSql.Append("iQTMethod=@iQTMethod,");
            strSql.Append("PictureGUID=@PictureGUID,");
            strSql.Append("bPlanInv=@bPlanInv,");
            strSql.Append("bProxyForeign=@bProxyForeign,");
            strSql.Append("bATOModel=@bATOModel,");
            strSql.Append("bCheckItem=@bCheckItem,");
            strSql.Append("bPTOModel=@bPTOModel,");
            strSql.Append("bEquipment=@bEquipment,");
            strSql.Append("cProductUnit=@cProductUnit,");
            strSql.Append("fOrderUpLimit=@fOrderUpLimit,");
            strSql.Append("cMassUnit=@cMassUnit,");
            strSql.Append("fRetailPrice=@fRetailPrice,");
            strSql.Append("cInvDepCode=@cInvDepCode,");
            strSql.Append("iAlterAdvance=@iAlterAdvance,");
            strSql.Append("fAlterBaseNum=@fAlterBaseNum,");
            strSql.Append("cPlanMethod=@cPlanMethod,");
            strSql.Append("bMPS=@bMPS,");
            strSql.Append("bROP=@bROP,");
            strSql.Append("bRePlan=@bRePlan,");
            strSql.Append("cSRPolicy=@cSRPolicy,");
            strSql.Append("bBillUnite=@bBillUnite,");
            strSql.Append("iSupplyDay=@iSupplyDay,");
            strSql.Append("fSupplyMulti=@fSupplyMulti,");
            strSql.Append("fMinSupply=@fMinSupply,");
            strSql.Append("bCutMantissa=@bCutMantissa,");
            strSql.Append("cInvPersonCode=@cInvPersonCode,");
            strSql.Append("iInvTfId=@iInvTfId,");
            strSql.Append("cEngineerFigNo=@cEngineerFigNo,");
            strSql.Append("bInTotalCost=@bInTotalCost,");
            strSql.Append("iSupplyType=@iSupplyType,");
            strSql.Append("bConfigFree1=@bConfigFree1,");
            strSql.Append("bConfigFree2=@bConfigFree2,");
            strSql.Append("bConfigFree3=@bConfigFree3,");
            strSql.Append("bConfigFree4=@bConfigFree4,");
            strSql.Append("bConfigFree5=@bConfigFree5,");
            strSql.Append("bConfigFree6=@bConfigFree6,");
            strSql.Append("bConfigFree7=@bConfigFree7,");
            strSql.Append("bConfigFree8=@bConfigFree8,");
            strSql.Append("bConfigFree9=@bConfigFree9,");
            strSql.Append("bConfigFree10=@bConfigFree10,");
            strSql.Append("iDTLevel=@iDTLevel,");
            strSql.Append("cDTAQL=@cDTAQL,");
            strSql.Append("bPeriodDT=@bPeriodDT,");
            strSql.Append("cDTPeriod=@cDTPeriod,");
            strSql.Append("iBigMonth=@iBigMonth,");
            strSql.Append("iBigDay=@iBigDay,");
            strSql.Append("iSmallMonth=@iSmallMonth,");
            strSql.Append("iSmallDay=@iSmallDay,");
            strSql.Append("bOutInvDT=@bOutInvDT,");
            strSql.Append("bBackInvDT=@bBackInvDT,");
            strSql.Append("iEndDTStyle=@iEndDTStyle,");
            strSql.Append("bDTWarnInv=@bDTWarnInv,");
            strSql.Append("fBackTaxRate=@fBackTaxRate,");
            strSql.Append("cCIQCode=@cCIQCode,");
            strSql.Append("cWGroupCode=@cWGroupCode,");
            strSql.Append("cWUnit=@cWUnit,");
            strSql.Append("fGrossW=@fGrossW,");
            strSql.Append("cVGroupCode=@cVGroupCode,");
            strSql.Append("cVUnit=@cVUnit,");
            strSql.Append("fLength=@fLength,");
            strSql.Append("fWidth=@fWidth,");
            strSql.Append("fHeight=@fHeight,");
            strSql.Append("iDTUCounter=@iDTUCounter,");
            strSql.Append("iDTDCounter=@iDTDCounter,");
            strSql.Append("iBatchCounter=@iBatchCounter,");
            strSql.Append("cShopUnit=@cShopUnit,");
            strSql.Append("cPurPersonCode=@cPurPersonCode,");
            strSql.Append("bImportMedicine=@bImportMedicine,");
            strSql.Append("bFirstBusiMedicine=@bFirstBusiMedicine,");
            strSql.Append("bForeExpland=@bForeExpland,");
            strSql.Append("cInvPlanCode=@cInvPlanCode,");
            strSql.Append("fConvertRate=@fConvertRate,");
            strSql.Append("dReplaceDate=@dReplaceDate,");
            strSql.Append("bInvModel=@bInvModel,");
            strSql.Append("bKCCutMantissa=@bKCCutMantissa,");
            strSql.Append("bReceiptByDT=@bReceiptByDT,");
            strSql.Append("iImpTaxRate=@iImpTaxRate,");
            strSql.Append("iExpTaxRate=@iExpTaxRate,");
            strSql.Append("bExpSale=@bExpSale,");
            strSql.Append("iDrawBatch=@iDrawBatch,");
            strSql.Append("bCheckBSATP=@bCheckBSATP,");
            strSql.Append("cInvProjectCode=@cInvProjectCode,");
            strSql.Append("iTestRule=@iTestRule,");
            strSql.Append("cRuleCode=@cRuleCode,");
            strSql.Append("bCheckFree1=@bCheckFree1,");
            strSql.Append("bCheckFree2=@bCheckFree2,");
            strSql.Append("bCheckFree3=@bCheckFree3,");
            strSql.Append("bCheckFree4=@bCheckFree4,");
            strSql.Append("bCheckFree5=@bCheckFree5,");
            strSql.Append("bCheckFree6=@bCheckFree6,");
            strSql.Append("bCheckFree7=@bCheckFree7,");
            strSql.Append("bCheckFree8=@bCheckFree8,");
            strSql.Append("bCheckFree9=@bCheckFree9,");
            strSql.Append("bCheckFree10=@bCheckFree10,");
            strSql.Append("bBomMain=@bBomMain,");
            strSql.Append("bBomSub=@bBomSub,");
            strSql.Append("bProductBill=@bProductBill,");
            strSql.Append("iCheckATP=@iCheckATP,");
            strSql.Append("iInvATPId=@iInvATPId,");
            strSql.Append("iPlanTfDay=@iPlanTfDay,");
            strSql.Append("iOverlapDay=@iOverlapDay,");
            strSql.Append("bPiece=@bPiece,");
            strSql.Append("bSrvItem=@bSrvItem,");
            strSql.Append("bSrvFittings=@bSrvFittings,");
            strSql.Append("fMaxSupply=@fMaxSupply,");
            strSql.Append("fMinSplit=@fMinSplit,");
            strSql.Append("bSpecialOrder=@bSpecialOrder,");
            strSql.Append("bTrackSaleBill=@bTrackSaleBill,");
            strSql.Append("cInvMnemCode=@cInvMnemCode");
            strSql.Append(" where cInvCode=@cInvCode ");
            SqlParameter[] parameters = {
                    new SqlParameter("@cInvAddCode", SqlDbType.NVarChar,255),
                    new SqlParameter("@cInvName", SqlDbType.NVarChar,255),
                    new SqlParameter("@cInvStd", SqlDbType.NVarChar,255),
                    new SqlParameter("@cInvCCode", SqlDbType.NVarChar,12),
                    new SqlParameter("@cVenCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@cReplaceItem", SqlDbType.NVarChar,60),
                    new SqlParameter("@cPosition", SqlDbType.NVarChar,20),
                    new SqlParameter("@bSale", SqlDbType.Bit,1),
                    new SqlParameter("@bPurchase", SqlDbType.Bit,1),
                    new SqlParameter("@bSelf", SqlDbType.Bit,1),
                    new SqlParameter("@bComsume", SqlDbType.Bit,1),
                    new SqlParameter("@bProducing", SqlDbType.Bit,1),
                    new SqlParameter("@bService", SqlDbType.Bit,1),
                    new SqlParameter("@bAccessary", SqlDbType.Bit,1),
                    new SqlParameter("@iTaxRate", SqlDbType.Float,8),
                    new SqlParameter("@iInvWeight", SqlDbType.Float,8),
                    new SqlParameter("@iVolume", SqlDbType.Float,8),
                    new SqlParameter("@iInvRCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvSPrice", SqlDbType.Float,8),
                    new SqlParameter("@iInvSCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvLSCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvNCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvAdvance", SqlDbType.Float,8),
                    new SqlParameter("@iInvBatch", SqlDbType.Float,8),
                    new SqlParameter("@iSafeNum", SqlDbType.Float,8),
                    new SqlParameter("@iTopSum", SqlDbType.Float,8),
                    new SqlParameter("@iLowSum", SqlDbType.Float,8),
                    new SqlParameter("@iOverStock", SqlDbType.Float,8),
                    new SqlParameter("@cInvABC", SqlDbType.NVarChar,1),
                    new SqlParameter("@bInvQuality", SqlDbType.Bit,1),
                    new SqlParameter("@bInvBatch", SqlDbType.Bit,1),
                    new SqlParameter("@bInvEntrust", SqlDbType.Bit,1),
                    new SqlParameter("@bInvOverStock", SqlDbType.Bit,1),
                    new SqlParameter("@dSDate", SqlDbType.DateTime),
                    new SqlParameter("@dEDate", SqlDbType.DateTime),
                    new SqlParameter("@bFree1", SqlDbType.Bit,1),
                    new SqlParameter("@bFree2", SqlDbType.Bit,1),
                    new SqlParameter("@cInvDefine1", SqlDbType.NVarChar,20),
                    new SqlParameter("@cInvDefine2", SqlDbType.NVarChar,20),
                    new SqlParameter("@cInvDefine3", SqlDbType.NVarChar,20),
                    new SqlParameter("@bInvType", SqlDbType.Bit,1),
                    new SqlParameter("@iInvMPCost", SqlDbType.Float,8),
                    new SqlParameter("@cQuality", SqlDbType.NVarChar,100),
                    new SqlParameter("@iInvSaleCost", SqlDbType.Float,8),
                    new SqlParameter("@iInvSCost1", SqlDbType.Float,8),
                    new SqlParameter("@iInvSCost2", SqlDbType.Float,8),
                    new SqlParameter("@iInvSCost3", SqlDbType.Float,8),
                    new SqlParameter("@bFree3", SqlDbType.Bit,1),
                    new SqlParameter("@bFree4", SqlDbType.Bit,1),
                    new SqlParameter("@bFree5", SqlDbType.Bit,1),
                    new SqlParameter("@bFree6", SqlDbType.Bit,1),
                    new SqlParameter("@bFree7", SqlDbType.Bit,1),
                    new SqlParameter("@bFree8", SqlDbType.Bit,1),
                    new SqlParameter("@bFree9", SqlDbType.Bit,1),
                    new SqlParameter("@bFree10", SqlDbType.Bit,1),
                    new SqlParameter("@cCreatePerson", SqlDbType.NVarChar,20),
                    new SqlParameter("@cModifyPerson", SqlDbType.NVarChar,20),
                    new SqlParameter("@dModifyDate", SqlDbType.DateTime),
                    new SqlParameter("@fSubscribePoint", SqlDbType.Float,8),
                    new SqlParameter("@fVagQuantity", SqlDbType.Float,8),
                    new SqlParameter("@cValueType", SqlDbType.NVarChar,20),
                    new SqlParameter("@bFixExch", SqlDbType.Bit,1),
                    new SqlParameter("@fOutExcess", SqlDbType.Float,8),
                    new SqlParameter("@fInExcess", SqlDbType.Float,8),
                    new SqlParameter("@iMassDate", SqlDbType.SmallInt,2),
                    new SqlParameter("@iWarnDays", SqlDbType.SmallInt,2),
                    new SqlParameter("@fExpensesExch", SqlDbType.Float,8),
                    new SqlParameter("@bTrack", SqlDbType.Bit,1),
                    new SqlParameter("@bSerial", SqlDbType.Bit,1),
                    new SqlParameter("@bBarCode", SqlDbType.Bit,1),
                    new SqlParameter("@iId", SqlDbType.Int,4),
                    new SqlParameter("@cBarCode", SqlDbType.NVarChar,30),
                    new SqlParameter("@cInvDefine4", SqlDbType.NVarChar,60),
                    new SqlParameter("@cInvDefine5", SqlDbType.NVarChar,60),
                    new SqlParameter("@cInvDefine6", SqlDbType.NVarChar,60),
                    new SqlParameter("@cInvDefine7", SqlDbType.NVarChar,120),
                    new SqlParameter("@cInvDefine8", SqlDbType.NVarChar,120),
                    new SqlParameter("@cInvDefine9", SqlDbType.NVarChar,120),
                    new SqlParameter("@cInvDefine10", SqlDbType.NVarChar,120),
                    new SqlParameter("@cInvDefine11", SqlDbType.Int,4),
                    new SqlParameter("@cInvDefine12", SqlDbType.Int,4),
                    new SqlParameter("@cInvDefine13", SqlDbType.Float,8),
                    new SqlParameter("@cInvDefine14", SqlDbType.Float,8),
                    new SqlParameter("@cInvDefine15", SqlDbType.DateTime),
                    new SqlParameter("@cInvDefine16", SqlDbType.DateTime),
                    new SqlParameter("@iGroupType", SqlDbType.TinyInt,1),
                    new SqlParameter("@cGroupCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cAssComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cSAComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cPUComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cSTComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cCAComUnitCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cFrequency", SqlDbType.NVarChar,10),
                    new SqlParameter("@iFrequency", SqlDbType.SmallInt,2),
                    new SqlParameter("@iDays", SqlDbType.SmallInt,2),
                    new SqlParameter("@dLastDate", SqlDbType.DateTime),
                    new SqlParameter("@iWastage", SqlDbType.Float,8),
                    new SqlParameter("@bSolitude", SqlDbType.Bit,1),
                    new SqlParameter("@cEnterprise", SqlDbType.NVarChar,100),
                    new SqlParameter("@cAddress", SqlDbType.NVarChar,255),
                    new SqlParameter("@cFile", SqlDbType.NVarChar,40),
                    new SqlParameter("@cLabel", SqlDbType.NVarChar,30),
                    new SqlParameter("@cCheckOut", SqlDbType.NVarChar,30),
                    new SqlParameter("@cLicence", SqlDbType.NVarChar,30),
                    new SqlParameter("@bSpecialties", SqlDbType.Bit,1),
                    new SqlParameter("@cDefWareHouse", SqlDbType.NVarChar,10),
                    new SqlParameter("@iHighPrice", SqlDbType.Float,8),
                    new SqlParameter("@iExpSaleRate", SqlDbType.Float,8),
                    new SqlParameter("@cPriceGroup", SqlDbType.NVarChar,20),
                    new SqlParameter("@cOfferGrade", SqlDbType.NVarChar,20),
                    new SqlParameter("@iOfferRate", SqlDbType.Float,8),
                    new SqlParameter("@cMonth", SqlDbType.NVarChar,6),
                    new SqlParameter("@iAdvanceDate", SqlDbType.SmallInt,2),
                    new SqlParameter("@cCurrencyName", SqlDbType.NVarChar,60),
                    new SqlParameter("@cProduceAddress", SqlDbType.NVarChar,255),
                    new SqlParameter("@cProduceNation", SqlDbType.NVarChar,60),
                    new SqlParameter("@cRegisterNo", SqlDbType.NVarChar,60),
                    new SqlParameter("@cEnterNo", SqlDbType.NVarChar,60),
                    new SqlParameter("@cPackingType", SqlDbType.NVarChar,60),
                    new SqlParameter("@cEnglishName", SqlDbType.NVarChar,100),
                    new SqlParameter("@bPropertyCheck", SqlDbType.Bit,1),
                    new SqlParameter("@cPreparationType", SqlDbType.NVarChar,30),
                    new SqlParameter("@cCommodity", SqlDbType.NVarChar,60),
                    new SqlParameter("@iRecipeBatch", SqlDbType.TinyInt,1),
                    new SqlParameter("@cNotPatentName", SqlDbType.NVarChar,30),
                    new SqlParameter("@bPromotSales", SqlDbType.Bit,1),
                    new SqlParameter("@iPlanPolicy", SqlDbType.SmallInt,2),
                    new SqlParameter("@iROPMethod", SqlDbType.SmallInt,2),
                    new SqlParameter("@iBatchRule", SqlDbType.SmallInt,2),
                    new SqlParameter("@fBatchIncrement", SqlDbType.Float,8),
                    new SqlParameter("@iAssureProvideDays", SqlDbType.Int,4),
                    new SqlParameter("@iTestStyle", SqlDbType.SmallInt,2),
                    new SqlParameter("@iDTMethod", SqlDbType.SmallInt,2),
                    new SqlParameter("@fDTRate", SqlDbType.Float,8),
                    new SqlParameter("@fDTNum", SqlDbType.Float,8),
                    new SqlParameter("@cDTUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@iDTStyle", SqlDbType.SmallInt,2),
                    new SqlParameter("@iQTMethod", SqlDbType.Int,4),
                    new SqlParameter("@PictureGUID", SqlDbType.UniqueIdentifier,16),
                    new SqlParameter("@bPlanInv", SqlDbType.Bit,1),
                    new SqlParameter("@bProxyForeign", SqlDbType.Bit,1),
                    new SqlParameter("@bATOModel", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckItem", SqlDbType.Bit,1),
                    new SqlParameter("@bPTOModel", SqlDbType.Bit,1),
                    new SqlParameter("@bEquipment", SqlDbType.Bit,1),
                    new SqlParameter("@cProductUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@fOrderUpLimit", SqlDbType.Float,8),
                    new SqlParameter("@cMassUnit", SqlDbType.SmallInt,2),
                    new SqlParameter("@fRetailPrice", SqlDbType.Float,8),
                    new SqlParameter("@cInvDepCode", SqlDbType.NVarChar,12),
                    new SqlParameter("@iAlterAdvance", SqlDbType.Int,4),
                    new SqlParameter("@fAlterBaseNum", SqlDbType.Float,8),
                    new SqlParameter("@cPlanMethod", SqlDbType.NVarChar,1),
                    new SqlParameter("@bMPS", SqlDbType.Bit,1),
                    new SqlParameter("@bROP", SqlDbType.Bit,1),
                    new SqlParameter("@bRePlan", SqlDbType.Bit,1),
                    new SqlParameter("@cSRPolicy", SqlDbType.NVarChar,2),
                    new SqlParameter("@bBillUnite", SqlDbType.Bit,1),
                    new SqlParameter("@iSupplyDay", SqlDbType.Int,4),
                    new SqlParameter("@fSupplyMulti", SqlDbType.Float,8),
                    new SqlParameter("@fMinSupply", SqlDbType.Float,8),
                    new SqlParameter("@bCutMantissa", SqlDbType.Bit,1),
                    new SqlParameter("@cInvPersonCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@iInvTfId", SqlDbType.Int,4),
                    new SqlParameter("@cEngineerFigNo", SqlDbType.NVarChar,60),
                    new SqlParameter("@bInTotalCost", SqlDbType.Bit,1),
                    new SqlParameter("@iSupplyType", SqlDbType.SmallInt,2),
                    new SqlParameter("@bConfigFree1", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree2", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree3", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree4", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree5", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree6", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree7", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree8", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree9", SqlDbType.Bit,1),
                    new SqlParameter("@bConfigFree10", SqlDbType.Bit,1),
                    new SqlParameter("@iDTLevel", SqlDbType.SmallInt,2),
                    new SqlParameter("@cDTAQL", SqlDbType.NVarChar,20),
                    new SqlParameter("@bPeriodDT", SqlDbType.Bit,1),
                    new SqlParameter("@cDTPeriod", SqlDbType.NVarChar,30),
                    new SqlParameter("@iBigMonth", SqlDbType.Int,4),
                    new SqlParameter("@iBigDay", SqlDbType.Int,4),
                    new SqlParameter("@iSmallMonth", SqlDbType.Int,4),
                    new SqlParameter("@iSmallDay", SqlDbType.Int,4),
                    new SqlParameter("@bOutInvDT", SqlDbType.Bit,1),
                    new SqlParameter("@bBackInvDT", SqlDbType.Bit,1),
                    new SqlParameter("@iEndDTStyle", SqlDbType.SmallInt,2),
                    new SqlParameter("@bDTWarnInv", SqlDbType.Bit,1),
                    new SqlParameter("@fBackTaxRate", SqlDbType.Float,8),
                    new SqlParameter("@cCIQCode", SqlDbType.NVarChar,30),
                    new SqlParameter("@cWGroupCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cWUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@fGrossW", SqlDbType.Float,8),
                    new SqlParameter("@cVGroupCode", SqlDbType.NVarChar,35),
                    new SqlParameter("@cVUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@fLength", SqlDbType.Float,8),
                    new SqlParameter("@fWidth", SqlDbType.Float,8),
                    new SqlParameter("@fHeight", SqlDbType.Float,8),
                    new SqlParameter("@iDTUCounter", SqlDbType.Int,4),
                    new SqlParameter("@iDTDCounter", SqlDbType.Int,4),
                    new SqlParameter("@iBatchCounter", SqlDbType.Int,4),
                    new SqlParameter("@cShopUnit", SqlDbType.NVarChar,35),
                    new SqlParameter("@cPurPersonCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@bImportMedicine", SqlDbType.Bit,1),
                    new SqlParameter("@bFirstBusiMedicine", SqlDbType.Bit,1),
                    new SqlParameter("@bForeExpland", SqlDbType.Bit,1),
                    new SqlParameter("@cInvPlanCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@fConvertRate", SqlDbType.Float,8),
                    new SqlParameter("@dReplaceDate", SqlDbType.DateTime),
                    new SqlParameter("@bInvModel", SqlDbType.Bit,1),
                    new SqlParameter("@bKCCutMantissa", SqlDbType.Bit,1),
                    new SqlParameter("@bReceiptByDT", SqlDbType.Bit,1),
                    new SqlParameter("@iImpTaxRate", SqlDbType.Float,8),
                    new SqlParameter("@iExpTaxRate", SqlDbType.Float,8),
                    new SqlParameter("@bExpSale", SqlDbType.Bit,1),
                    new SqlParameter("@iDrawBatch", SqlDbType.Float,8),
                    new SqlParameter("@bCheckBSATP", SqlDbType.Bit,1),
                    new SqlParameter("@cInvProjectCode", SqlDbType.NVarChar,16),
                    new SqlParameter("@iTestRule", SqlDbType.SmallInt,2),
                    new SqlParameter("@cRuleCode", SqlDbType.NVarChar,20),
                    new SqlParameter("@bCheckFree1", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree2", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree3", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree4", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree5", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree6", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree7", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree8", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree9", SqlDbType.Bit,1),
                    new SqlParameter("@bCheckFree10", SqlDbType.Bit,1),
                    new SqlParameter("@bBomMain", SqlDbType.Bit,1),
                    new SqlParameter("@bBomSub", SqlDbType.Bit,1),
                    new SqlParameter("@bProductBill", SqlDbType.Bit,1),
                    new SqlParameter("@iCheckATP", SqlDbType.SmallInt,2),
                    new SqlParameter("@iInvATPId", SqlDbType.Int,4),
                    new SqlParameter("@iPlanTfDay", SqlDbType.Int,4),
                    new SqlParameter("@iOverlapDay", SqlDbType.Int,4),
                    new SqlParameter("@bPiece", SqlDbType.Bit,1),
                    new SqlParameter("@bSrvItem", SqlDbType.Bit,1),
                    new SqlParameter("@bSrvFittings", SqlDbType.Bit,1),
                    new SqlParameter("@fMaxSupply", SqlDbType.Float,8),
                    new SqlParameter("@fMinSplit", SqlDbType.Float,8),
                    new SqlParameter("@bSpecialOrder", SqlDbType.Bit,1),
                    new SqlParameter("@bTrackSaleBill", SqlDbType.Bit,1),
                    new SqlParameter("@cInvMnemCode", SqlDbType.NVarChar,40),
                    new SqlParameter("@cInvCode", SqlDbType.NVarChar,60),
                    new SqlParameter("@I_id", SqlDbType.Int,4)};
            parameters[0].Value = model.cInvAddCode;
            parameters[1].Value = model.cInvName;
            parameters[2].Value = model.cInvStd;
            parameters[3].Value = model.cInvCCode;
            parameters[4].Value = model.cVenCode;
            parameters[5].Value = model.cReplaceItem;
            parameters[6].Value = model.cPosition;
            parameters[7].Value = model.bSale;
            parameters[8].Value = model.bPurchase;
            parameters[9].Value = model.bSelf;
            parameters[10].Value = model.bComsume;
            parameters[11].Value = model.bProducing;
            parameters[12].Value = model.bService;
            parameters[13].Value = model.bAccessary;
            parameters[14].Value = model.iTaxRate;
            parameters[15].Value = model.iInvWeight;
            parameters[16].Value = model.iVolume;
            parameters[17].Value = model.iInvRCost;
            parameters[18].Value = model.iInvSPrice;
            parameters[19].Value = model.iInvSCost;
            parameters[20].Value = model.iInvLSCost;
            parameters[21].Value = model.iInvNCost;
            parameters[22].Value = model.iInvAdvance;
            parameters[23].Value = model.iInvBatch;
            parameters[24].Value = model.iSafeNum;
            parameters[25].Value = model.iTopSum;
            parameters[26].Value = model.iLowSum;
            parameters[27].Value = model.iOverStock;
            parameters[28].Value = model.cInvABC;
            parameters[29].Value = model.bInvQuality;
            parameters[30].Value = model.bInvBatch;
            parameters[31].Value = model.bInvEntrust;
            parameters[32].Value = model.bInvOverStock;
            parameters[33].Value = model.dSDate;
            parameters[34].Value = model.dEDate;
            parameters[35].Value = model.bFree1;
            parameters[36].Value = model.bFree2;
            parameters[37].Value = model.cInvDefine1;
            parameters[38].Value = model.cInvDefine2;
            parameters[39].Value = model.cInvDefine3;
            parameters[40].Value = model.bInvType;
            parameters[41].Value = model.iInvMPCost;
            parameters[42].Value = model.cQuality;
            parameters[43].Value = model.iInvSaleCost;
            parameters[44].Value = model.iInvSCost1;
            parameters[45].Value = model.iInvSCost2;
            parameters[46].Value = model.iInvSCost3;
            parameters[47].Value = model.bFree3;
            parameters[48].Value = model.bFree4;
            parameters[49].Value = model.bFree5;
            parameters[50].Value = model.bFree6;
            parameters[51].Value = model.bFree7;
            parameters[52].Value = model.bFree8;
            parameters[53].Value = model.bFree9;
            parameters[54].Value = model.bFree10;
            parameters[55].Value = model.cCreatePerson;
            parameters[56].Value = model.cModifyPerson;
            parameters[57].Value = model.dModifyDate;
            parameters[58].Value = model.fSubscribePoint;
            parameters[59].Value = model.fVagQuantity;
            parameters[60].Value = model.cValueType;
            parameters[61].Value = model.bFixExch;
            parameters[62].Value = model.fOutExcess;
            parameters[63].Value = model.fInExcess;
            parameters[64].Value = model.iMassDate;
            parameters[65].Value = model.iWarnDays;
            parameters[66].Value = model.fExpensesExch;
            parameters[67].Value = model.bTrack;
            parameters[68].Value = model.bSerial;
            parameters[69].Value = model.bBarCode;
            parameters[70].Value = model.iId;
            parameters[71].Value = model.cBarCode;
            parameters[72].Value = model.cInvDefine4;
            parameters[73].Value = model.cInvDefine5;
            parameters[74].Value = model.cInvDefine6;
            parameters[75].Value = model.cInvDefine7;
            parameters[76].Value = model.cInvDefine8;
            parameters[77].Value = model.cInvDefine9;
            parameters[78].Value = model.cInvDefine10;
            parameters[79].Value = model.cInvDefine11;
            parameters[80].Value = model.cInvDefine12;
            parameters[81].Value = model.cInvDefine13;
            parameters[82].Value = model.cInvDefine14;
            parameters[83].Value = model.cInvDefine15;
            parameters[84].Value = model.cInvDefine16;
            parameters[85].Value = model.iGroupType;
            parameters[86].Value = model.cGroupCode;
            parameters[87].Value = model.cComUnitCode;
            parameters[88].Value = model.cAssComUnitCode;
            parameters[89].Value = model.cSAComUnitCode;
            parameters[90].Value = model.cPUComUnitCode;
            parameters[91].Value = model.cSTComUnitCode;
            parameters[92].Value = model.cCAComUnitCode;
            parameters[93].Value = model.cFrequency;
            parameters[94].Value = model.iFrequency;
            parameters[95].Value = model.iDays;
            parameters[96].Value = model.dLastDate;
            parameters[97].Value = model.iWastage;
            parameters[98].Value = model.bSolitude;
            parameters[99].Value = model.cEnterprise;
            parameters[100].Value = model.cAddress;
            parameters[101].Value = model.cFile;
            parameters[102].Value = model.cLabel;
            parameters[103].Value = model.cCheckOut;
            parameters[104].Value = model.cLicence;
            parameters[105].Value = model.bSpecialties;
            parameters[106].Value = model.cDefWareHouse;
            parameters[107].Value = model.iHighPrice;
            parameters[108].Value = model.iExpSaleRate;
            parameters[109].Value = model.cPriceGroup;
            parameters[110].Value = model.cOfferGrade;
            parameters[111].Value = model.iOfferRate;
            parameters[112].Value = model.cMonth;
            parameters[113].Value = model.iAdvanceDate;
            parameters[114].Value = model.cCurrencyName;
            parameters[115].Value = model.cProduceAddress;
            parameters[116].Value = model.cProduceNation;
            parameters[117].Value = model.cRegisterNo;
            parameters[118].Value = model.cEnterNo;
            parameters[119].Value = model.cPackingType;
            parameters[120].Value = model.cEnglishName;
            parameters[121].Value = model.bPropertyCheck;
            parameters[122].Value = model.cPreparationType;
            parameters[123].Value = model.cCommodity;
            parameters[124].Value = model.iRecipeBatch;
            parameters[125].Value = model.cNotPatentName;
            parameters[126].Value = model.bPromotSales;
            parameters[127].Value = model.iPlanPolicy;
            parameters[128].Value = model.iROPMethod;
            parameters[129].Value = model.iBatchRule;
            parameters[130].Value = model.fBatchIncrement;
            parameters[131].Value = model.iAssureProvideDays;
            parameters[132].Value = model.iTestStyle;
            parameters[133].Value = model.iDTMethod;
            parameters[134].Value = model.fDTRate;
            parameters[135].Value = model.fDTNum;
            parameters[136].Value = model.cDTUnit;
            parameters[137].Value = model.iDTStyle;
            parameters[138].Value = model.iQTMethod;
            parameters[139].Value = model.PictureGUID;
            parameters[140].Value = model.bPlanInv;
            parameters[141].Value = model.bProxyForeign;
            parameters[142].Value = model.bATOModel;
            parameters[143].Value = model.bCheckItem;
            parameters[144].Value = model.bPTOModel;
            parameters[145].Value = model.bEquipment;
            parameters[146].Value = model.cProductUnit;
            parameters[147].Value = model.fOrderUpLimit;
            parameters[148].Value = model.cMassUnit;
            parameters[149].Value = model.fRetailPrice;
            parameters[150].Value = model.cInvDepCode;
            parameters[151].Value = model.iAlterAdvance;
            parameters[152].Value = model.fAlterBaseNum;
            parameters[153].Value = model.cPlanMethod;
            parameters[154].Value = model.bMPS;
            parameters[155].Value = model.bROP;
            parameters[156].Value = model.bRePlan;
            parameters[157].Value = model.cSRPolicy;
            parameters[158].Value = model.bBillUnite;
            parameters[159].Value = model.iSupplyDay;
            parameters[160].Value = model.fSupplyMulti;
            parameters[161].Value = model.fMinSupply;
            parameters[162].Value = model.bCutMantissa;
            parameters[163].Value = model.cInvPersonCode;
            parameters[164].Value = model.iInvTfId;
            parameters[165].Value = model.cEngineerFigNo;
            parameters[166].Value = model.bInTotalCost;
            parameters[167].Value = model.iSupplyType;
            parameters[168].Value = model.bConfigFree1;
            parameters[169].Value = model.bConfigFree2;
            parameters[170].Value = model.bConfigFree3;
            parameters[171].Value = model.bConfigFree4;
            parameters[172].Value = model.bConfigFree5;
            parameters[173].Value = model.bConfigFree6;
            parameters[174].Value = model.bConfigFree7;
            parameters[175].Value = model.bConfigFree8;
            parameters[176].Value = model.bConfigFree9;
            parameters[177].Value = model.bConfigFree10;
            parameters[178].Value = model.iDTLevel;
            parameters[179].Value = model.cDTAQL;
            parameters[180].Value = model.bPeriodDT;
            parameters[181].Value = model.cDTPeriod;
            parameters[182].Value = model.iBigMonth;
            parameters[183].Value = model.iBigDay;
            parameters[184].Value = model.iSmallMonth;
            parameters[185].Value = model.iSmallDay;
            parameters[186].Value = model.bOutInvDT;
            parameters[187].Value = model.bBackInvDT;
            parameters[188].Value = model.iEndDTStyle;
            parameters[189].Value = model.bDTWarnInv;
            parameters[190].Value = model.fBackTaxRate;
            parameters[191].Value = model.cCIQCode;
            parameters[192].Value = model.cWGroupCode;
            parameters[193].Value = model.cWUnit;
            parameters[194].Value = model.fGrossW;
            parameters[195].Value = model.cVGroupCode;
            parameters[196].Value = model.cVUnit;
            parameters[197].Value = model.fLength;
            parameters[198].Value = model.fWidth;
            parameters[199].Value = model.fHeight;
            parameters[200].Value = model.iDTUCounter;
            parameters[201].Value = model.iDTDCounter;
            parameters[202].Value = model.iBatchCounter;
            parameters[203].Value = model.cShopUnit;
            parameters[204].Value = model.cPurPersonCode;
            parameters[205].Value = model.bImportMedicine;
            parameters[206].Value = model.bFirstBusiMedicine;
            parameters[207].Value = model.bForeExpland;
            parameters[208].Value = model.cInvPlanCode;
            parameters[209].Value = model.fConvertRate;
            parameters[210].Value = model.dReplaceDate;
            parameters[211].Value = model.bInvModel;
            parameters[212].Value = model.bKCCutMantissa;
            parameters[213].Value = model.bReceiptByDT;
            parameters[214].Value = model.iImpTaxRate;
            parameters[215].Value = model.iExpTaxRate;
            parameters[216].Value = model.bExpSale;
            parameters[217].Value = model.iDrawBatch;
            parameters[218].Value = model.bCheckBSATP;
            parameters[219].Value = model.cInvProjectCode;
            parameters[220].Value = model.iTestRule;
            parameters[221].Value = model.cRuleCode;
            parameters[222].Value = model.bCheckFree1;
            parameters[223].Value = model.bCheckFree2;
            parameters[224].Value = model.bCheckFree3;
            parameters[225].Value = model.bCheckFree4;
            parameters[226].Value = model.bCheckFree5;
            parameters[227].Value = model.bCheckFree6;
            parameters[228].Value = model.bCheckFree7;
            parameters[229].Value = model.bCheckFree8;
            parameters[230].Value = model.bCheckFree9;
            parameters[231].Value = model.bCheckFree10;
            parameters[232].Value = model.bBomMain;
            parameters[233].Value = model.bBomSub;
            parameters[234].Value = model.bProductBill;
            parameters[235].Value = model.iCheckATP;
            parameters[236].Value = model.iInvATPId;
            parameters[237].Value = model.iPlanTfDay;
            parameters[238].Value = model.iOverlapDay;
            parameters[239].Value = model.bPiece;
            parameters[240].Value = model.bSrvItem;
            parameters[241].Value = model.bSrvFittings;
            parameters[242].Value = model.fMaxSupply;
            parameters[243].Value = model.fMinSplit;
            parameters[244].Value = model.bSpecialOrder;
            parameters[245].Value = model.bTrackSaleBill;
            parameters[246].Value = model.cInvMnemCode;
            parameters[247].Value = model.cInvCode;
            parameters[248].Value = model.I_id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string cInvCode)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from Inventory ");
            strSql.Append(" where cInvCode=@cInvCode ");
            SqlParameter[] parameters = {
                    new SqlParameter("@cInvCode", SqlDbType.NVarChar,60)            };
            parameters[0].Value = cInvCode;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string cInvCodelist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from Inventory ");
            strSql.Append(" where cInvCode in (" + cInvCodelist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Inventory GetModel(string cInvCode)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 cInvCode,cInvAddCode,cInvName,cInvStd,cInvCCode,cVenCode,cReplaceItem,cPosition,bSale,bPurchase,bSelf,bComsume,bProducing,bService,bAccessary,iTaxRate,iInvWeight,iVolume,iInvRCost,iInvSPrice,iInvSCost,iInvLSCost,iInvNCost,iInvAdvance,iInvBatch,iSafeNum,iTopSum,iLowSum,iOverStock,cInvABC,bInvQuality,bInvBatch,bInvEntrust,bInvOverStock,dSDate,dEDate,bFree1,bFree2,cInvDefine1,cInvDefine2,cInvDefine3,I_id,bInvType,iInvMPCost,cQuality,iInvSaleCost,iInvSCost1,iInvSCost2,iInvSCost3,bFree3,bFree4,bFree5,bFree6,bFree7,bFree8,bFree9,bFree10,cCreatePerson,cModifyPerson,dModifyDate,fSubscribePoint,fVagQuantity,cValueType,bFixExch,fOutExcess,fInExcess,iMassDate,iWarnDays,fExpensesExch,bTrack,bSerial,bBarCode,iId,cBarCode,cInvDefine4,cInvDefine5,cInvDefine6,cInvDefine7,cInvDefine8,cInvDefine9,cInvDefine10,cInvDefine11,cInvDefine12,cInvDefine13,cInvDefine14,cInvDefine15,cInvDefine16,iGroupType,cGroupCode,cComUnitCode,cAssComUnitCode,cSAComUnitCode,cPUComUnitCode,cSTComUnitCode,cCAComUnitCode,cFrequency,iFrequency,iDays,dLastDate,iWastage,bSolitude,cEnterprise,cAddress,cFile,cLabel,cCheckOut,cLicence,bSpecialties,cDefWareHouse,iHighPrice,iExpSaleRate,cPriceGroup,cOfferGrade,iOfferRate,cMonth,iAdvanceDate,cCurrencyName,cProduceAddress,cProduceNation,cRegisterNo,cEnterNo,cPackingType,cEnglishName,bPropertyCheck,cPreparationType,cCommodity,iRecipeBatch,cNotPatentName,bPromotSales,iPlanPolicy,iROPMethod,iBatchRule,fBatchIncrement,iAssureProvideDays,iTestStyle,iDTMethod,fDTRate,fDTNum,cDTUnit,iDTStyle,iQTMethod,PictureGUID,bPlanInv,bProxyForeign,bATOModel,bCheckItem,bPTOModel,bEquipment,cProductUnit,fOrderUpLimit,cMassUnit,fRetailPrice,cInvDepCode,iAlterAdvance,fAlterBaseNum,cPlanMethod,bMPS,bROP,bRePlan,cSRPolicy,bBillUnite,iSupplyDay,fSupplyMulti,fMinSupply,bCutMantissa,cInvPersonCode,iInvTfId,cEngineerFigNo,bInTotalCost,iSupplyType,bConfigFree1,bConfigFree2,bConfigFree3,bConfigFree4,bConfigFree5,bConfigFree6,bConfigFree7,bConfigFree8,bConfigFree9,bConfigFree10,iDTLevel,cDTAQL,bPeriodDT,cDTPeriod,iBigMonth,iBigDay,iSmallMonth,iSmallDay,bOutInvDT,bBackInvDT,iEndDTStyle,bDTWarnInv,fBackTaxRate,cCIQCode,cWGroupCode,cWUnit,fGrossW,cVGroupCode,cVUnit,fLength,fWidth,fHeight,iDTUCounter,iDTDCounter,iBatchCounter,cShopUnit,cPurPersonCode,bImportMedicine,bFirstBusiMedicine,bForeExpland,cInvPlanCode,fConvertRate,dReplaceDate,bInvModel,bKCCutMantissa,bReceiptByDT,iImpTaxRate,iExpTaxRate,bExpSale,iDrawBatch,bCheckBSATP,cInvProjectCode,iTestRule,cRuleCode,bCheckFree1,bCheckFree2,bCheckFree3,bCheckFree4,bCheckFree5,bCheckFree6,bCheckFree7,bCheckFree8,bCheckFree9,bCheckFree10,bBomMain,bBomSub,bProductBill,iCheckATP,iInvATPId,iPlanTfDay,iOverlapDay,bPiece,bSrvItem,bSrvFittings,fMaxSupply,fMinSplit,bSpecialOrder,bTrackSaleBill,cInvMnemCode from Inventory ");
            strSql.Append(" where cInvCode=@cInvCode ");
            SqlParameter[] parameters = {
                    new SqlParameter("@cInvCode", SqlDbType.NVarChar,60)            };
            parameters[0].Value = cInvCode;

            Maticsoft.Model.Inventory model = new Maticsoft.Model.Inventory();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Inventory DataRowToModel(DataRow row)
        {
            Maticsoft.Model.Inventory model = new Maticsoft.Model.Inventory();
            if (row != null)
            {
                if (row["cInvCode"] != null)
                {
                    model.cInvCode = row["cInvCode"].ToString();
                }
                if (row["cInvAddCode"] != null)
                {
                    model.cInvAddCode = row["cInvAddCode"].ToString();
                }
                if (row["cInvName"] != null)
                {
                    model.cInvName = row["cInvName"].ToString();
                }
                if (row["cInvStd"] != null)
                {
                    model.cInvStd = row["cInvStd"].ToString();
                }
                if (row["cInvCCode"] != null)
                {
                    model.cInvCCode = row["cInvCCode"].ToString();
                }
                if (row["cVenCode"] != null)
                {
                    model.cVenCode = row["cVenCode"].ToString();
                }
                if (row["cReplaceItem"] != null)
                {
                    model.cReplaceItem = row["cReplaceItem"].ToString();
                }
                if (row["cPosition"] != null)
                {
                    model.cPosition = row["cPosition"].ToString();
                }
                if (row["bSale"] != null && row["bSale"].ToString() != "")
                {
                    if ((row["bSale"].ToString() == "1") || (row["bSale"].ToString().ToLower() == "true"))
                    {
                        model.bSale = true;
                    }
                    else
                    {
                        model.bSale = false;
                    }
                }
                if (row["bPurchase"] != null && row["bPurchase"].ToString() != "")
                {
                    if ((row["bPurchase"].ToString() == "1") || (row["bPurchase"].ToString().ToLower() == "true"))
                    {
                        model.bPurchase = true;
                    }
                    else
                    {
                        model.bPurchase = false;
                    }
                }
                if (row["bSelf"] != null && row["bSelf"].ToString() != "")
                {
                    if ((row["bSelf"].ToString() == "1") || (row["bSelf"].ToString().ToLower() == "true"))
                    {
                        model.bSelf = true;
                    }
                    else
                    {
                        model.bSelf = false;
                    }
                }
                if (row["bComsume"] != null && row["bComsume"].ToString() != "")
                {
                    if ((row["bComsume"].ToString() == "1") || (row["bComsume"].ToString().ToLower() == "true"))
                    {
                        model.bComsume = true;
                    }
                    else
                    {
                        model.bComsume = false;
                    }
                }
                if (row["bProducing"] != null && row["bProducing"].ToString() != "")
                {
                    if ((row["bProducing"].ToString() == "1") || (row["bProducing"].ToString().ToLower() == "true"))
                    {
                        model.bProducing = true;
                    }
                    else
                    {
                        model.bProducing = false;
                    }
                }
                if (row["bService"] != null && row["bService"].ToString() != "")
                {
                    if ((row["bService"].ToString() == "1") || (row["bService"].ToString().ToLower() == "true"))
                    {
                        model.bService = true;
                    }
                    else
                    {
                        model.bService = false;
                    }
                }
                if (row["bAccessary"] != null && row["bAccessary"].ToString() != "")
                {
                    if ((row["bAccessary"].ToString() == "1") || (row["bAccessary"].ToString().ToLower() == "true"))
                    {
                        model.bAccessary = true;
                    }
                    else
                    {
                        model.bAccessary = false;
                    }
                }
                if (row["iTaxRate"] != null && row["iTaxRate"].ToString() != "")
                {
                    model.iTaxRate = decimal.Parse(row["iTaxRate"].ToString());
                }
                if (row["iInvWeight"] != null && row["iInvWeight"].ToString() != "")
                {
                    model.iInvWeight = decimal.Parse(row["iInvWeight"].ToString());
                }
                if (row["iVolume"] != null && row["iVolume"].ToString() != "")
                {
                    model.iVolume = decimal.Parse(row["iVolume"].ToString());
                }
                if (row["iInvRCost"] != null && row["iInvRCost"].ToString() != "")
                {
                    model.iInvRCost = decimal.Parse(row["iInvRCost"].ToString());
                }
                if (row["iInvSPrice"] != null && row["iInvSPrice"].ToString() != "")
                {
                    model.iInvSPrice = decimal.Parse(row["iInvSPrice"].ToString());
                }
                if (row["iInvSCost"] != null && row["iInvSCost"].ToString() != "")
                {
                    model.iInvSCost = decimal.Parse(row["iInvSCost"].ToString());
                }
                if (row["iInvLSCost"] != null && row["iInvLSCost"].ToString() != "")
                {
                    model.iInvLSCost = decimal.Parse(row["iInvLSCost"].ToString());
                }
                if (row["iInvNCost"] != null && row["iInvNCost"].ToString() != "")
                {
                    model.iInvNCost = decimal.Parse(row["iInvNCost"].ToString());
                }
                if (row["iInvAdvance"] != null && row["iInvAdvance"].ToString() != "")
                {
                    model.iInvAdvance = decimal.Parse(row["iInvAdvance"].ToString());
                }
                if (row["iInvBatch"] != null && row["iInvBatch"].ToString() != "")
                {
                    model.iInvBatch = decimal.Parse(row["iInvBatch"].ToString());
                }
                if (row["iSafeNum"] != null && row["iSafeNum"].ToString() != "")
                {
                    model.iSafeNum = decimal.Parse(row["iSafeNum"].ToString());
                }
                if (row["iTopSum"] != null && row["iTopSum"].ToString() != "")
                {
                    model.iTopSum = decimal.Parse(row["iTopSum"].ToString());
                }
                if (row["iLowSum"] != null && row["iLowSum"].ToString() != "")
                {
                    model.iLowSum = decimal.Parse(row["iLowSum"].ToString());
                }
                if (row["iOverStock"] != null && row["iOverStock"].ToString() != "")
                {
                    model.iOverStock = decimal.Parse(row["iOverStock"].ToString());
                }
                if (row["cInvABC"] != null)
                {
                    model.cInvABC = row["cInvABC"].ToString();
                }
                if (row["bInvQuality"] != null && row["bInvQuality"].ToString() != "")
                {
                    if ((row["bInvQuality"].ToString() == "1") || (row["bInvQuality"].ToString().ToLower() == "true"))
                    {
                        model.bInvQuality = true;
                    }
                    else
                    {
                        model.bInvQuality = false;
                    }
                }
                if (row["bInvBatch"] != null && row["bInvBatch"].ToString() != "")
                {
                    if ((row["bInvBatch"].ToString() == "1") || (row["bInvBatch"].ToString().ToLower() == "true"))
                    {
                        model.bInvBatch = true;
                    }
                    else
                    {
                        model.bInvBatch = false;
                    }
                }
                if (row["bInvEntrust"] != null && row["bInvEntrust"].ToString() != "")
                {
                    if ((row["bInvEntrust"].ToString() == "1") || (row["bInvEntrust"].ToString().ToLower() == "true"))
                    {
                        model.bInvEntrust = true;
                    }
                    else
                    {
                        model.bInvEntrust = false;
                    }
                }
                if (row["bInvOverStock"] != null && row["bInvOverStock"].ToString() != "")
                {
                    if ((row["bInvOverStock"].ToString() == "1") || (row["bInvOverStock"].ToString().ToLower() == "true"))
                    {
                        model.bInvOverStock = true;
                    }
                    else
                    {
                        model.bInvOverStock = false;
                    }
                }
                if (row["dSDate"] != null && row["dSDate"].ToString() != "")
                {
                    model.dSDate = DateTime.Parse(row["dSDate"].ToString());
                }
                if (row["dEDate"] != null && row["dEDate"].ToString() != "")
                {
                    model.dEDate = DateTime.Parse(row["dEDate"].ToString());
                }
                if (row["bFree1"] != null && row["bFree1"].ToString() != "")
                {
                    if ((row["bFree1"].ToString() == "1") || (row["bFree1"].ToString().ToLower() == "true"))
                    {
                        model.bFree1 = true;
                    }
                    else
                    {
                        model.bFree1 = false;
                    }
                }
                if (row["bFree2"] != null && row["bFree2"].ToString() != "")
                {
                    if ((row["bFree2"].ToString() == "1") || (row["bFree2"].ToString().ToLower() == "true"))
                    {
                        model.bFree2 = true;
                    }
                    else
                    {
                        model.bFree2 = false;
                    }
                }
                if (row["cInvDefine1"] != null)
                {
                    model.cInvDefine1 = row["cInvDefine1"].ToString();
                }
                if (row["cInvDefine2"] != null)
                {
                    model.cInvDefine2 = row["cInvDefine2"].ToString();
                }
                if (row["cInvDefine3"] != null)
                {
                    model.cInvDefine3 = row["cInvDefine3"].ToString();
                }
                if (row["I_id"] != null && row["I_id"].ToString() != "")
                {
                    model.I_id = int.Parse(row["I_id"].ToString());
                }
                if (row["bInvType"] != null && row["bInvType"].ToString() != "")
                {
                    if ((row["bInvType"].ToString() == "1") || (row["bInvType"].ToString().ToLower() == "true"))
                    {
                        model.bInvType = true;
                    }
                    else
                    {
                        model.bInvType = false;
                    }
                }
                if (row["iInvMPCost"] != null && row["iInvMPCost"].ToString() != "")
                {
                    model.iInvMPCost = decimal.Parse(row["iInvMPCost"].ToString());
                }
                if (row["cQuality"] != null)
                {
                    model.cQuality = row["cQuality"].ToString();
                }
                if (row["iInvSaleCost"] != null && row["iInvSaleCost"].ToString() != "")
                {
                    model.iInvSaleCost = decimal.Parse(row["iInvSaleCost"].ToString());
                }
                if (row["iInvSCost1"] != null && row["iInvSCost1"].ToString() != "")
                {
                    model.iInvSCost1 = decimal.Parse(row["iInvSCost1"].ToString());
                }
                if (row["iInvSCost2"] != null && row["iInvSCost2"].ToString() != "")
                {
                    model.iInvSCost2 = decimal.Parse(row["iInvSCost2"].ToString());
                }
                if (row["iInvSCost3"] != null && row["iInvSCost3"].ToString() != "")
                {
                    model.iInvSCost3 = decimal.Parse(row["iInvSCost3"].ToString());
                }
                if (row["bFree3"] != null && row["bFree3"].ToString() != "")
                {
                    if ((row["bFree3"].ToString() == "1") || (row["bFree3"].ToString().ToLower() == "true"))
                    {
                        model.bFree3 = true;
                    }
                    else
                    {
                        model.bFree3 = false;
                    }
                }
                if (row["bFree4"] != null && row["bFree4"].ToString() != "")
                {
                    if ((row["bFree4"].ToString() == "1") || (row["bFree4"].ToString().ToLower() == "true"))
                    {
                        model.bFree4 = true;
                    }
                    else
                    {
                        model.bFree4 = false;
                    }
                }
                if (row["bFree5"] != null && row["bFree5"].ToString() != "")
                {
                    if ((row["bFree5"].ToString() == "1") || (row["bFree5"].ToString().ToLower() == "true"))
                    {
                        model.bFree5 = true;
                    }
                    else
                    {
                        model.bFree5 = false;
                    }
                }
                if (row["bFree6"] != null && row["bFree6"].ToString() != "")
                {
                    if ((row["bFree6"].ToString() == "1") || (row["bFree6"].ToString().ToLower() == "true"))
                    {
                        model.bFree6 = true;
                    }
                    else
                    {
                        model.bFree6 = false;
                    }
                }
                if (row["bFree7"] != null && row["bFree7"].ToString() != "")
                {
                    if ((row["bFree7"].ToString() == "1") || (row["bFree7"].ToString().ToLower() == "true"))
                    {
                        model.bFree7 = true;
                    }
                    else
                    {
                        model.bFree7 = false;
                    }
                }
                if (row["bFree8"] != null && row["bFree8"].ToString() != "")
                {
                    if ((row["bFree8"].ToString() == "1") || (row["bFree8"].ToString().ToLower() == "true"))
                    {
                        model.bFree8 = true;
                    }
                    else
                    {
                        model.bFree8 = false;
                    }
                }
                if (row["bFree9"] != null && row["bFree9"].ToString() != "")
                {
                    if ((row["bFree9"].ToString() == "1") || (row["bFree9"].ToString().ToLower() == "true"))
                    {
                        model.bFree9 = true;
                    }
                    else
                    {
                        model.bFree9 = false;
                    }
                }
                if (row["bFree10"] != null && row["bFree10"].ToString() != "")
                {
                    if ((row["bFree10"].ToString() == "1") || (row["bFree10"].ToString().ToLower() == "true"))
                    {
                        model.bFree10 = true;
                    }
                    else
                    {
                        model.bFree10 = false;
                    }
                }
                if (row["cCreatePerson"] != null)
                {
                    model.cCreatePerson = row["cCreatePerson"].ToString();
                }
                if (row["cModifyPerson"] != null)
                {
                    model.cModifyPerson = row["cModifyPerson"].ToString();
                }
                if (row["dModifyDate"] != null && row["dModifyDate"].ToString() != "")
                {
                    model.dModifyDate = DateTime.Parse(row["dModifyDate"].ToString());
                }
                if (row["fSubscribePoint"] != null && row["fSubscribePoint"].ToString() != "")
                {
                    model.fSubscribePoint = decimal.Parse(row["fSubscribePoint"].ToString());
                }
                if (row["fVagQuantity"] != null && row["fVagQuantity"].ToString() != "")
                {
                    model.fVagQuantity = decimal.Parse(row["fVagQuantity"].ToString());
                }
                if (row["cValueType"] != null)
                {
                    model.cValueType = row["cValueType"].ToString();
                }
                if (row["bFixExch"] != null && row["bFixExch"].ToString() != "")
                {
                    if ((row["bFixExch"].ToString() == "1") || (row["bFixExch"].ToString().ToLower() == "true"))
                    {
                        model.bFixExch = true;
                    }
                    else
                    {
                        model.bFixExch = false;
                    }
                }
                if (row["fOutExcess"] != null && row["fOutExcess"].ToString() != "")
                {
                    model.fOutExcess = decimal.Parse(row["fOutExcess"].ToString());
                }
                if (row["fInExcess"] != null && row["fInExcess"].ToString() != "")
                {
                    model.fInExcess = decimal.Parse(row["fInExcess"].ToString());
                }
                if (row["iMassDate"] != null && row["iMassDate"].ToString() != "")
                {
                    model.iMassDate = int.Parse(row["iMassDate"].ToString());
                }
                if (row["iWarnDays"] != null && row["iWarnDays"].ToString() != "")
                {
                    model.iWarnDays = int.Parse(row["iWarnDays"].ToString());
                }
                if (row["fExpensesExch"] != null && row["fExpensesExch"].ToString() != "")
                {
                    model.fExpensesExch = decimal.Parse(row["fExpensesExch"].ToString());
                }
                if (row["bTrack"] != null && row["bTrack"].ToString() != "")
                {
                    if ((row["bTrack"].ToString() == "1") || (row["bTrack"].ToString().ToLower() == "true"))
                    {
                        model.bTrack = true;
                    }
                    else
                    {
                        model.bTrack = false;
                    }
                }
                if (row["bSerial"] != null && row["bSerial"].ToString() != "")
                {
                    if ((row["bSerial"].ToString() == "1") || (row["bSerial"].ToString().ToLower() == "true"))
                    {
                        model.bSerial = true;
                    }
                    else
                    {
                        model.bSerial = false;
                    }
                }
                if (row["bBarCode"] != null && row["bBarCode"].ToString() != "")
                {
                    if ((row["bBarCode"].ToString() == "1") || (row["bBarCode"].ToString().ToLower() == "true"))
                    {
                        model.bBarCode = true;
                    }
                    else
                    {
                        model.bBarCode = false;
                    }
                }
                if (row["iId"] != null && row["iId"].ToString() != "")
                {
                    model.iId = int.Parse(row["iId"].ToString());
                }
                if (row["cBarCode"] != null)
                {
                    model.cBarCode = row["cBarCode"].ToString();
                }
                if (row["cInvDefine4"] != null)
                {
                    model.cInvDefine4 = row["cInvDefine4"].ToString();
                }
                if (row["cInvDefine5"] != null)
                {
                    model.cInvDefine5 = row["cInvDefine5"].ToString();
                }
                if (row["cInvDefine6"] != null)
                {
                    model.cInvDefine6 = row["cInvDefine6"].ToString();
                }
                if (row["cInvDefine7"] != null)
                {
                    model.cInvDefine7 = row["cInvDefine7"].ToString();
                }
                if (row["cInvDefine8"] != null)
                {
                    model.cInvDefine8 = row["cInvDefine8"].ToString();
                }
                if (row["cInvDefine9"] != null)
                {
                    model.cInvDefine9 = row["cInvDefine9"].ToString();
                }
                if (row["cInvDefine10"] != null)
                {
                    model.cInvDefine10 = row["cInvDefine10"].ToString();
                }
                if (row["cInvDefine11"] != null && row["cInvDefine11"].ToString() != "")
                {
                    model.cInvDefine11 = int.Parse(row["cInvDefine11"].ToString());
                }
                if (row["cInvDefine12"] != null && row["cInvDefine12"].ToString() != "")
                {
                    model.cInvDefine12 = int.Parse(row["cInvDefine12"].ToString());
                }
                if (row["cInvDefine13"] != null && row["cInvDefine13"].ToString() != "")
                {
                    model.cInvDefine13 = decimal.Parse(row["cInvDefine13"].ToString());
                }
                if (row["cInvDefine14"] != null && row["cInvDefine14"].ToString() != "")
                {
                    model.cInvDefine14 = decimal.Parse(row["cInvDefine14"].ToString());
                }
                if (row["cInvDefine15"] != null && row["cInvDefine15"].ToString() != "")
                {
                    model.cInvDefine15 = DateTime.Parse(row["cInvDefine15"].ToString());
                }
                if (row["cInvDefine16"] != null && row["cInvDefine16"].ToString() != "")
                {
                    model.cInvDefine16 = DateTime.Parse(row["cInvDefine16"].ToString());
                }
                if (row["iGroupType"] != null && row["iGroupType"].ToString() != "")
                {
                    model.iGroupType = int.Parse(row["iGroupType"].ToString());
                }
                if (row["cGroupCode"] != null)
                {
                    model.cGroupCode = row["cGroupCode"].ToString();
                }
                if (row["cComUnitCode"] != null)
                {
                    model.cComUnitCode = row["cComUnitCode"].ToString();
                }
                if (row["cAssComUnitCode"] != null)
                {
                    model.cAssComUnitCode = row["cAssComUnitCode"].ToString();
                }
                if (row["cSAComUnitCode"] != null)
                {
                    model.cSAComUnitCode = row["cSAComUnitCode"].ToString();
                }
                if (row["cPUComUnitCode"] != null)
                {
                    model.cPUComUnitCode = row["cPUComUnitCode"].ToString();
                }
                if (row["cSTComUnitCode"] != null)
                {
                    model.cSTComUnitCode = row["cSTComUnitCode"].ToString();
                }
                if (row["cCAComUnitCode"] != null)
                {
                    model.cCAComUnitCode = row["cCAComUnitCode"].ToString();
                }
                if (row["cFrequency"] != null)
                {
                    model.cFrequency = row["cFrequency"].ToString();
                }
                if (row["iFrequency"] != null && row["iFrequency"].ToString() != "")
                {
                    model.iFrequency = int.Parse(row["iFrequency"].ToString());
                }
                if (row["iDays"] != null && row["iDays"].ToString() != "")
                {
                    model.iDays = int.Parse(row["iDays"].ToString());
                }
                if (row["dLastDate"] != null && row["dLastDate"].ToString() != "")
                {
                    model.dLastDate = DateTime.Parse(row["dLastDate"].ToString());
                }
                if (row["iWastage"] != null && row["iWastage"].ToString() != "")
                {
                    model.iWastage = decimal.Parse(row["iWastage"].ToString());
                }
                if (row["bSolitude"] != null && row["bSolitude"].ToString() != "")
                {
                    if ((row["bSolitude"].ToString() == "1") || (row["bSolitude"].ToString().ToLower() == "true"))
                    {
                        model.bSolitude = true;
                    }
                    else
                    {
                        model.bSolitude = false;
                    }
                }
                if (row["cEnterprise"] != null)
                {
                    model.cEnterprise = row["cEnterprise"].ToString();
                }
                if (row["cAddress"] != null)
                {
                    model.cAddress = row["cAddress"].ToString();
                }
                if (row["cFile"] != null)
                {
                    model.cFile = row["cFile"].ToString();
                }
                if (row["cLabel"] != null)
                {
                    model.cLabel = row["cLabel"].ToString();
                }
                if (row["cCheckOut"] != null)
                {
                    model.cCheckOut = row["cCheckOut"].ToString();
                }
                if (row["cLicence"] != null)
                {
                    model.cLicence = row["cLicence"].ToString();
                }
                if (row["bSpecialties"] != null && row["bSpecialties"].ToString() != "")
                {
                    if ((row["bSpecialties"].ToString() == "1") || (row["bSpecialties"].ToString().ToLower() == "true"))
                    {
                        model.bSpecialties = true;
                    }
                    else
                    {
                        model.bSpecialties = false;
                    }
                }
                if (row["cDefWareHouse"] != null)
                {
                    model.cDefWareHouse = row["cDefWareHouse"].ToString();
                }
                if (row["iHighPrice"] != null && row["iHighPrice"].ToString() != "")
                {
                    model.iHighPrice = decimal.Parse(row["iHighPrice"].ToString());
                }
                if (row["iExpSaleRate"] != null && row["iExpSaleRate"].ToString() != "")
                {
                    model.iExpSaleRate = decimal.Parse(row["iExpSaleRate"].ToString());
                }
                if (row["cPriceGroup"] != null)
                {
                    model.cPriceGroup = row["cPriceGroup"].ToString();
                }
                if (row["cOfferGrade"] != null)
                {
                    model.cOfferGrade = row["cOfferGrade"].ToString();
                }
                if (row["iOfferRate"] != null && row["iOfferRate"].ToString() != "")
                {
                    model.iOfferRate = decimal.Parse(row["iOfferRate"].ToString());
                }
                if (row["cMonth"] != null)
                {
                    model.cMonth = row["cMonth"].ToString();
                }
                if (row["iAdvanceDate"] != null && row["iAdvanceDate"].ToString() != "")
                {
                    model.iAdvanceDate = int.Parse(row["iAdvanceDate"].ToString());
                }
                if (row["cCurrencyName"] != null)
                {
                    model.cCurrencyName = row["cCurrencyName"].ToString();
                }
                if (row["cProduceAddress"] != null)
                {
                    model.cProduceAddress = row["cProduceAddress"].ToString();
                }
                if (row["cProduceNation"] != null)
                {
                    model.cProduceNation = row["cProduceNation"].ToString();
                }
                if (row["cRegisterNo"] != null)
                {
                    model.cRegisterNo = row["cRegisterNo"].ToString();
                }
                if (row["cEnterNo"] != null)
                {
                    model.cEnterNo = row["cEnterNo"].ToString();
                }
                if (row["cPackingType"] != null)
                {
                    model.cPackingType = row["cPackingType"].ToString();
                }
                if (row["cEnglishName"] != null)
                {
                    model.cEnglishName = row["cEnglishName"].ToString();
                }
                if (row["bPropertyCheck"] != null && row["bPropertyCheck"].ToString() != "")
                {
                    if ((row["bPropertyCheck"].ToString() == "1") || (row["bPropertyCheck"].ToString().ToLower() == "true"))
                    {
                        model.bPropertyCheck = true;
                    }
                    else
                    {
                        model.bPropertyCheck = false;
                    }
                }
                if (row["cPreparationType"] != null)
                {
                    model.cPreparationType = row["cPreparationType"].ToString();
                }
                if (row["cCommodity"] != null)
                {
                    model.cCommodity = row["cCommodity"].ToString();
                }
                if (row["iRecipeBatch"] != null && row["iRecipeBatch"].ToString() != "")
                {
                    model.iRecipeBatch = int.Parse(row["iRecipeBatch"].ToString());
                }
                if (row["cNotPatentName"] != null)
                {
                    model.cNotPatentName = row["cNotPatentName"].ToString();
                }
                if (row["bPromotSales"] != null && row["bPromotSales"].ToString() != "")
                {
                    if ((row["bPromotSales"].ToString() == "1") || (row["bPromotSales"].ToString().ToLower() == "true"))
                    {
                        model.bPromotSales = true;
                    }
                    else
                    {
                        model.bPromotSales = false;
                    }
                }
                if (row["iPlanPolicy"] != null && row["iPlanPolicy"].ToString() != "")
                {
                    model.iPlanPolicy = int.Parse(row["iPlanPolicy"].ToString());
                }
                if (row["iROPMethod"] != null && row["iROPMethod"].ToString() != "")
                {
                    model.iROPMethod = int.Parse(row["iROPMethod"].ToString());
                }
                if (row["iBatchRule"] != null && row["iBatchRule"].ToString() != "")
                {
                    model.iBatchRule = int.Parse(row["iBatchRule"].ToString());
                }
                if (row["fBatchIncrement"] != null && row["fBatchIncrement"].ToString() != "")
                {
                    model.fBatchIncrement = decimal.Parse(row["fBatchIncrement"].ToString());
                }
                if (row["iAssureProvideDays"] != null && row["iAssureProvideDays"].ToString() != "")
                {
                    model.iAssureProvideDays = int.Parse(row["iAssureProvideDays"].ToString());
                }
                if (row["iTestStyle"] != null && row["iTestStyle"].ToString() != "")
                {
                    model.iTestStyle = int.Parse(row["iTestStyle"].ToString());
                }
                if (row["iDTMethod"] != null && row["iDTMethod"].ToString() != "")
                {
                    model.iDTMethod = int.Parse(row["iDTMethod"].ToString());
                }
                if (row["fDTRate"] != null && row["fDTRate"].ToString() != "")
                {
                    model.fDTRate = decimal.Parse(row["fDTRate"].ToString());
                }
                if (row["fDTNum"] != null && row["fDTNum"].ToString() != "")
                {
                    model.fDTNum = decimal.Parse(row["fDTNum"].ToString());
                }
                if (row["cDTUnit"] != null)
                {
                    model.cDTUnit = row["cDTUnit"].ToString();
                }
                if (row["iDTStyle"] != null && row["iDTStyle"].ToString() != "")
                {
                    model.iDTStyle = int.Parse(row["iDTStyle"].ToString());
                }
                if (row["iQTMethod"] != null && row["iQTMethod"].ToString() != "")
                {
                    model.iQTMethod = int.Parse(row["iQTMethod"].ToString());
                }
                if (row["PictureGUID"] != null && row["PictureGUID"].ToString() != "")
                {
                    model.PictureGUID = new Guid(row["PictureGUID"].ToString());
                }
                if (row["bPlanInv"] != null && row["bPlanInv"].ToString() != "")
                {
                    if ((row["bPlanInv"].ToString() == "1") || (row["bPlanInv"].ToString().ToLower() == "true"))
                    {
                        model.bPlanInv = true;
                    }
                    else
                    {
                        model.bPlanInv = false;
                    }
                }
                if (row["bProxyForeign"] != null && row["bProxyForeign"].ToString() != "")
                {
                    if ((row["bProxyForeign"].ToString() == "1") || (row["bProxyForeign"].ToString().ToLower() == "true"))
                    {
                        model.bProxyForeign = true;
                    }
                    else
                    {
                        model.bProxyForeign = false;
                    }
                }
                if (row["bATOModel"] != null && row["bATOModel"].ToString() != "")
                {
                    if ((row["bATOModel"].ToString() == "1") || (row["bATOModel"].ToString().ToLower() == "true"))
                    {
                        model.bATOModel = true;
                    }
                    else
                    {
                        model.bATOModel = false;
                    }
                }
                if (row["bCheckItem"] != null && row["bCheckItem"].ToString() != "")
                {
                    if ((row["bCheckItem"].ToString() == "1") || (row["bCheckItem"].ToString().ToLower() == "true"))
                    {
                        model.bCheckItem = true;
                    }
                    else
                    {
                        model.bCheckItem = false;
                    }
                }
                if (row["bPTOModel"] != null && row["bPTOModel"].ToString() != "")
                {
                    if ((row["bPTOModel"].ToString() == "1") || (row["bPTOModel"].ToString().ToLower() == "true"))
                    {
                        model.bPTOModel = true;
                    }
                    else
                    {
                        model.bPTOModel = false;
                    }
                }
                if (row["bEquipment"] != null && row["bEquipment"].ToString() != "")
                {
                    if ((row["bEquipment"].ToString() == "1") || (row["bEquipment"].ToString().ToLower() == "true"))
                    {
                        model.bEquipment = true;
                    }
                    else
                    {
                        model.bEquipment = false;
                    }
                }
                if (row["cProductUnit"] != null)
                {
                    model.cProductUnit = row["cProductUnit"].ToString();
                }
                if (row["fOrderUpLimit"] != null && row["fOrderUpLimit"].ToString() != "")
                {
                    model.fOrderUpLimit = decimal.Parse(row["fOrderUpLimit"].ToString());
                }
                if (row["cMassUnit"] != null && row["cMassUnit"].ToString() != "")
                {
                    model.cMassUnit = int.Parse(row["cMassUnit"].ToString());
                }
                if (row["fRetailPrice"] != null && row["fRetailPrice"].ToString() != "")
                {
                    model.fRetailPrice = decimal.Parse(row["fRetailPrice"].ToString());
                }
                if (row["cInvDepCode"] != null)
                {
                    model.cInvDepCode = row["cInvDepCode"].ToString();
                }
                if (row["iAlterAdvance"] != null && row["iAlterAdvance"].ToString() != "")
                {
                    model.iAlterAdvance = int.Parse(row["iAlterAdvance"].ToString());
                }
                if (row["fAlterBaseNum"] != null && row["fAlterBaseNum"].ToString() != "")
                {
                    model.fAlterBaseNum = decimal.Parse(row["fAlterBaseNum"].ToString());
                }
                if (row["cPlanMethod"] != null)
                {
                    model.cPlanMethod = row["cPlanMethod"].ToString();
                }
                if (row["bMPS"] != null && row["bMPS"].ToString() != "")
                {
                    if ((row["bMPS"].ToString() == "1") || (row["bMPS"].ToString().ToLower() == "true"))
                    {
                        model.bMPS = true;
                    }
                    else
                    {
                        model.bMPS = false;
                    }
                }
                if (row["bROP"] != null && row["bROP"].ToString() != "")
                {
                    if ((row["bROP"].ToString() == "1") || (row["bROP"].ToString().ToLower() == "true"))
                    {
                        model.bROP = true;
                    }
                    else
                    {
                        model.bROP = false;
                    }
                }
                if (row["bRePlan"] != null && row["bRePlan"].ToString() != "")
                {
                    if ((row["bRePlan"].ToString() == "1") || (row["bRePlan"].ToString().ToLower() == "true"))
                    {
                        model.bRePlan = true;
                    }
                    else
                    {
                        model.bRePlan = false;
                    }
                }
                if (row["cSRPolicy"] != null)
                {
                    model.cSRPolicy = row["cSRPolicy"].ToString();
                }
                if (row["bBillUnite"] != null && row["bBillUnite"].ToString() != "")
                {
                    if ((row["bBillUnite"].ToString() == "1") || (row["bBillUnite"].ToString().ToLower() == "true"))
                    {
                        model.bBillUnite = true;
                    }
                    else
                    {
                        model.bBillUnite = false;
                    }
                }
                if (row["iSupplyDay"] != null && row["iSupplyDay"].ToString() != "")
                {
                    model.iSupplyDay = int.Parse(row["iSupplyDay"].ToString());
                }
                if (row["fSupplyMulti"] != null && row["fSupplyMulti"].ToString() != "")
                {
                    model.fSupplyMulti = decimal.Parse(row["fSupplyMulti"].ToString());
                }
                if (row["fMinSupply"] != null && row["fMinSupply"].ToString() != "")
                {
                    model.fMinSupply = decimal.Parse(row["fMinSupply"].ToString());
                }
                if (row["bCutMantissa"] != null && row["bCutMantissa"].ToString() != "")
                {
                    if ((row["bCutMantissa"].ToString() == "1") || (row["bCutMantissa"].ToString().ToLower() == "true"))
                    {
                        model.bCutMantissa = true;
                    }
                    else
                    {
                        model.bCutMantissa = false;
                    }
                }
                if (row["cInvPersonCode"] != null)
                {
                    model.cInvPersonCode = row["cInvPersonCode"].ToString();
                }
                if (row["iInvTfId"] != null && row["iInvTfId"].ToString() != "")
                {
                    model.iInvTfId = int.Parse(row["iInvTfId"].ToString());
                }
                if (row["cEngineerFigNo"] != null)
                {
                    model.cEngineerFigNo = row["cEngineerFigNo"].ToString();
                }
                if (row["bInTotalCost"] != null && row["bInTotalCost"].ToString() != "")
                {
                    if ((row["bInTotalCost"].ToString() == "1") || (row["bInTotalCost"].ToString().ToLower() == "true"))
                    {
                        model.bInTotalCost = true;
                    }
                    else
                    {
                        model.bInTotalCost = false;
                    }
                }
                if (row["iSupplyType"] != null && row["iSupplyType"].ToString() != "")
                {
                    model.iSupplyType = int.Parse(row["iSupplyType"].ToString());
                }
                if (row["bConfigFree1"] != null && row["bConfigFree1"].ToString() != "")
                {
                    if ((row["bConfigFree1"].ToString() == "1") || (row["bConfigFree1"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree1 = true;
                    }
                    else
                    {
                        model.bConfigFree1 = false;
                    }
                }
                if (row["bConfigFree2"] != null && row["bConfigFree2"].ToString() != "")
                {
                    if ((row["bConfigFree2"].ToString() == "1") || (row["bConfigFree2"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree2 = true;
                    }
                    else
                    {
                        model.bConfigFree2 = false;
                    }
                }
                if (row["bConfigFree3"] != null && row["bConfigFree3"].ToString() != "")
                {
                    if ((row["bConfigFree3"].ToString() == "1") || (row["bConfigFree3"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree3 = true;
                    }
                    else
                    {
                        model.bConfigFree3 = false;
                    }
                }
                if (row["bConfigFree4"] != null && row["bConfigFree4"].ToString() != "")
                {
                    if ((row["bConfigFree4"].ToString() == "1") || (row["bConfigFree4"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree4 = true;
                    }
                    else
                    {
                        model.bConfigFree4 = false;
                    }
                }
                if (row["bConfigFree5"] != null && row["bConfigFree5"].ToString() != "")
                {
                    if ((row["bConfigFree5"].ToString() == "1") || (row["bConfigFree5"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree5 = true;
                    }
                    else
                    {
                        model.bConfigFree5 = false;
                    }
                }
                if (row["bConfigFree6"] != null && row["bConfigFree6"].ToString() != "")
                {
                    if ((row["bConfigFree6"].ToString() == "1") || (row["bConfigFree6"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree6 = true;
                    }
                    else
                    {
                        model.bConfigFree6 = false;
                    }
                }
                if (row["bConfigFree7"] != null && row["bConfigFree7"].ToString() != "")
                {
                    if ((row["bConfigFree7"].ToString() == "1") || (row["bConfigFree7"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree7 = true;
                    }
                    else
                    {
                        model.bConfigFree7 = false;
                    }
                }
                if (row["bConfigFree8"] != null && row["bConfigFree8"].ToString() != "")
                {
                    if ((row["bConfigFree8"].ToString() == "1") || (row["bConfigFree8"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree8 = true;
                    }
                    else
                    {
                        model.bConfigFree8 = false;
                    }
                }
                if (row["bConfigFree9"] != null && row["bConfigFree9"].ToString() != "")
                {
                    if ((row["bConfigFree9"].ToString() == "1") || (row["bConfigFree9"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree9 = true;
                    }
                    else
                    {
                        model.bConfigFree9 = false;
                    }
                }
                if (row["bConfigFree10"] != null && row["bConfigFree10"].ToString() != "")
                {
                    if ((row["bConfigFree10"].ToString() == "1") || (row["bConfigFree10"].ToString().ToLower() == "true"))
                    {
                        model.bConfigFree10 = true;
                    }
                    else
                    {
                        model.bConfigFree10 = false;
                    }
                }
                if (row["iDTLevel"] != null && row["iDTLevel"].ToString() != "")
                {
                    model.iDTLevel = int.Parse(row["iDTLevel"].ToString());
                }
                if (row["cDTAQL"] != null)
                {
                    model.cDTAQL = row["cDTAQL"].ToString();
                }
                if (row["bPeriodDT"] != null && row["bPeriodDT"].ToString() != "")
                {
                    if ((row["bPeriodDT"].ToString() == "1") || (row["bPeriodDT"].ToString().ToLower() == "true"))
                    {
                        model.bPeriodDT = true;
                    }
                    else
                    {
                        model.bPeriodDT = false;
                    }
                }
                if (row["cDTPeriod"] != null)
                {
                    model.cDTPeriod = row["cDTPeriod"].ToString();
                }
                if (row["iBigMonth"] != null && row["iBigMonth"].ToString() != "")
                {
                    model.iBigMonth = int.Parse(row["iBigMonth"].ToString());
                }
                if (row["iBigDay"] != null && row["iBigDay"].ToString() != "")
                {
                    model.iBigDay = int.Parse(row["iBigDay"].ToString());
                }
                if (row["iSmallMonth"] != null && row["iSmallMonth"].ToString() != "")
                {
                    model.iSmallMonth = int.Parse(row["iSmallMonth"].ToString());
                }
                if (row["iSmallDay"] != null && row["iSmallDay"].ToString() != "")
                {
                    model.iSmallDay = int.Parse(row["iSmallDay"].ToString());
                }
                if (row["bOutInvDT"] != null && row["bOutInvDT"].ToString() != "")
                {
                    if ((row["bOutInvDT"].ToString() == "1") || (row["bOutInvDT"].ToString().ToLower() == "true"))
                    {
                        model.bOutInvDT = true;
                    }
                    else
                    {
                        model.bOutInvDT = false;
                    }
                }
                if (row["bBackInvDT"] != null && row["bBackInvDT"].ToString() != "")
                {
                    if ((row["bBackInvDT"].ToString() == "1") || (row["bBackInvDT"].ToString().ToLower() == "true"))
                    {
                        model.bBackInvDT = true;
                    }
                    else
                    {
                        model.bBackInvDT = false;
                    }
                }
                if (row["iEndDTStyle"] != null && row["iEndDTStyle"].ToString() != "")
                {
                    model.iEndDTStyle = int.Parse(row["iEndDTStyle"].ToString());
                }
                if (row["bDTWarnInv"] != null && row["bDTWarnInv"].ToString() != "")
                {
                    if ((row["bDTWarnInv"].ToString() == "1") || (row["bDTWarnInv"].ToString().ToLower() == "true"))
                    {
                        model.bDTWarnInv = true;
                    }
                    else
                    {
                        model.bDTWarnInv = false;
                    }
                }
                if (row["fBackTaxRate"] != null && row["fBackTaxRate"].ToString() != "")
                {
                    model.fBackTaxRate = decimal.Parse(row["fBackTaxRate"].ToString());
                }
                if (row["cCIQCode"] != null)
                {
                    model.cCIQCode = row["cCIQCode"].ToString();
                }
                if (row["cWGroupCode"] != null)
                {
                    model.cWGroupCode = row["cWGroupCode"].ToString();
                }
                if (row["cWUnit"] != null)
                {
                    model.cWUnit = row["cWUnit"].ToString();
                }
                if (row["fGrossW"] != null && row["fGrossW"].ToString() != "")
                {
                    model.fGrossW = decimal.Parse(row["fGrossW"].ToString());
                }
                if (row["cVGroupCode"] != null)
                {
                    model.cVGroupCode = row["cVGroupCode"].ToString();
                }
                if (row["cVUnit"] != null)
                {
                    model.cVUnit = row["cVUnit"].ToString();
                }
                if (row["fLength"] != null && row["fLength"].ToString() != "")
                {
                    model.fLength = decimal.Parse(row["fLength"].ToString());
                }
                if (row["fWidth"] != null && row["fWidth"].ToString() != "")
                {
                    model.fWidth = decimal.Parse(row["fWidth"].ToString());
                }
                if (row["fHeight"] != null && row["fHeight"].ToString() != "")
                {
                    model.fHeight = decimal.Parse(row["fHeight"].ToString());
                }
                if (row["iDTUCounter"] != null && row["iDTUCounter"].ToString() != "")
                {
                    model.iDTUCounter = int.Parse(row["iDTUCounter"].ToString());
                }
                if (row["iDTDCounter"] != null && row["iDTDCounter"].ToString() != "")
                {
                    model.iDTDCounter = int.Parse(row["iDTDCounter"].ToString());
                }
                if (row["iBatchCounter"] != null && row["iBatchCounter"].ToString() != "")
                {
                    model.iBatchCounter = int.Parse(row["iBatchCounter"].ToString());
                }
                if (row["cShopUnit"] != null)
                {
                    model.cShopUnit = row["cShopUnit"].ToString();
                }
                if (row["cPurPersonCode"] != null)
                {
                    model.cPurPersonCode = row["cPurPersonCode"].ToString();
                }
                if (row["bImportMedicine"] != null && row["bImportMedicine"].ToString() != "")
                {
                    if ((row["bImportMedicine"].ToString() == "1") || (row["bImportMedicine"].ToString().ToLower() == "true"))
                    {
                        model.bImportMedicine = true;
                    }
                    else
                    {
                        model.bImportMedicine = false;
                    }
                }
                if (row["bFirstBusiMedicine"] != null && row["bFirstBusiMedicine"].ToString() != "")
                {
                    if ((row["bFirstBusiMedicine"].ToString() == "1") || (row["bFirstBusiMedicine"].ToString().ToLower() == "true"))
                    {
                        model.bFirstBusiMedicine = true;
                    }
                    else
                    {
                        model.bFirstBusiMedicine = false;
                    }
                }
                if (row["bForeExpland"] != null && row["bForeExpland"].ToString() != "")
                {
                    if ((row["bForeExpland"].ToString() == "1") || (row["bForeExpland"].ToString().ToLower() == "true"))
                    {
                        model.bForeExpland = true;
                    }
                    else
                    {
                        model.bForeExpland = false;
                    }
                }
                if (row["cInvPlanCode"] != null)
                {
                    model.cInvPlanCode = row["cInvPlanCode"].ToString();
                }
                if (row["fConvertRate"] != null && row["fConvertRate"].ToString() != "")
                {
                    model.fConvertRate = decimal.Parse(row["fConvertRate"].ToString());
                }
                if (row["dReplaceDate"] != null && row["dReplaceDate"].ToString() != "")
                {
                    model.dReplaceDate = DateTime.Parse(row["dReplaceDate"].ToString());
                }
                if (row["bInvModel"] != null && row["bInvModel"].ToString() != "")
                {
                    if ((row["bInvModel"].ToString() == "1") || (row["bInvModel"].ToString().ToLower() == "true"))
                    {
                        model.bInvModel = true;
                    }
                    else
                    {
                        model.bInvModel = false;
                    }
                }
                if (row["bKCCutMantissa"] != null && row["bKCCutMantissa"].ToString() != "")
                {
                    if ((row["bKCCutMantissa"].ToString() == "1") || (row["bKCCutMantissa"].ToString().ToLower() == "true"))
                    {
                        model.bKCCutMantissa = true;
                    }
                    else
                    {
                        model.bKCCutMantissa = false;
                    }
                }
                if (row["bReceiptByDT"] != null && row["bReceiptByDT"].ToString() != "")
                {
                    if ((row["bReceiptByDT"].ToString() == "1") || (row["bReceiptByDT"].ToString().ToLower() == "true"))
                    {
                        model.bReceiptByDT = true;
                    }
                    else
                    {
                        model.bReceiptByDT = false;
                    }
                }
                if (row["iImpTaxRate"] != null && row["iImpTaxRate"].ToString() != "")
                {
                    model.iImpTaxRate = decimal.Parse(row["iImpTaxRate"].ToString());
                }
                if (row["iExpTaxRate"] != null && row["iExpTaxRate"].ToString() != "")
                {
                    model.iExpTaxRate = decimal.Parse(row["iExpTaxRate"].ToString());
                }
                if (row["bExpSale"] != null && row["bExpSale"].ToString() != "")
                {
                    if ((row["bExpSale"].ToString() == "1") || (row["bExpSale"].ToString().ToLower() == "true"))
                    {
                        model.bExpSale = true;
                    }
                    else
                    {
                        model.bExpSale = false;
                    }
                }
                if (row["iDrawBatch"] != null && row["iDrawBatch"].ToString() != "")
                {
                    model.iDrawBatch = decimal.Parse(row["iDrawBatch"].ToString());
                }
                if (row["bCheckBSATP"] != null && row["bCheckBSATP"].ToString() != "")
                {
                    if ((row["bCheckBSATP"].ToString() == "1") || (row["bCheckBSATP"].ToString().ToLower() == "true"))
                    {
                        model.bCheckBSATP = true;
                    }
                    else
                    {
                        model.bCheckBSATP = false;
                    }
                }
                if (row["cInvProjectCode"] != null)
                {
                    model.cInvProjectCode = row["cInvProjectCode"].ToString();
                }
                if (row["iTestRule"] != null && row["iTestRule"].ToString() != "")
                {
                    model.iTestRule = int.Parse(row["iTestRule"].ToString());
                }
                if (row["cRuleCode"] != null)
                {
                    model.cRuleCode = row["cRuleCode"].ToString();
                }
                if (row["bCheckFree1"] != null && row["bCheckFree1"].ToString() != "")
                {
                    if ((row["bCheckFree1"].ToString() == "1") || (row["bCheckFree1"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree1 = true;
                    }
                    else
                    {
                        model.bCheckFree1 = false;
                    }
                }
                if (row["bCheckFree2"] != null && row["bCheckFree2"].ToString() != "")
                {
                    if ((row["bCheckFree2"].ToString() == "1") || (row["bCheckFree2"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree2 = true;
                    }
                    else
                    {
                        model.bCheckFree2 = false;
                    }
                }
                if (row["bCheckFree3"] != null && row["bCheckFree3"].ToString() != "")
                {
                    if ((row["bCheckFree3"].ToString() == "1") || (row["bCheckFree3"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree3 = true;
                    }
                    else
                    {
                        model.bCheckFree3 = false;
                    }
                }
                if (row["bCheckFree4"] != null && row["bCheckFree4"].ToString() != "")
                {
                    if ((row["bCheckFree4"].ToString() == "1") || (row["bCheckFree4"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree4 = true;
                    }
                    else
                    {
                        model.bCheckFree4 = false;
                    }
                }
                if (row["bCheckFree5"] != null && row["bCheckFree5"].ToString() != "")
                {
                    if ((row["bCheckFree5"].ToString() == "1") || (row["bCheckFree5"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree5 = true;
                    }
                    else
                    {
                        model.bCheckFree5 = false;
                    }
                }
                if (row["bCheckFree6"] != null && row["bCheckFree6"].ToString() != "")
                {
                    if ((row["bCheckFree6"].ToString() == "1") || (row["bCheckFree6"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree6 = true;
                    }
                    else
                    {
                        model.bCheckFree6 = false;
                    }
                }
                if (row["bCheckFree7"] != null && row["bCheckFree7"].ToString() != "")
                {
                    if ((row["bCheckFree7"].ToString() == "1") || (row["bCheckFree7"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree7 = true;
                    }
                    else
                    {
                        model.bCheckFree7 = false;
                    }
                }
                if (row["bCheckFree8"] != null && row["bCheckFree8"].ToString() != "")
                {
                    if ((row["bCheckFree8"].ToString() == "1") || (row["bCheckFree8"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree8 = true;
                    }
                    else
                    {
                        model.bCheckFree8 = false;
                    }
                }
                if (row["bCheckFree9"] != null && row["bCheckFree9"].ToString() != "")
                {
                    if ((row["bCheckFree9"].ToString() == "1") || (row["bCheckFree9"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree9 = true;
                    }
                    else
                    {
                        model.bCheckFree9 = false;
                    }
                }
                if (row["bCheckFree10"] != null && row["bCheckFree10"].ToString() != "")
                {
                    if ((row["bCheckFree10"].ToString() == "1") || (row["bCheckFree10"].ToString().ToLower() == "true"))
                    {
                        model.bCheckFree10 = true;
                    }
                    else
                    {
                        model.bCheckFree10 = false;
                    }
                }
                if (row["bBomMain"] != null && row["bBomMain"].ToString() != "")
                {
                    if ((row["bBomMain"].ToString() == "1") || (row["bBomMain"].ToString().ToLower() == "true"))
                    {
                        model.bBomMain = true;
                    }
                    else
                    {
                        model.bBomMain = false;
                    }
                }
                if (row["bBomSub"] != null && row["bBomSub"].ToString() != "")
                {
                    if ((row["bBomSub"].ToString() == "1") || (row["bBomSub"].ToString().ToLower() == "true"))
                    {
                        model.bBomSub = true;
                    }
                    else
                    {
                        model.bBomSub = false;
                    }
                }
                if (row["bProductBill"] != null && row["bProductBill"].ToString() != "")
                {
                    if ((row["bProductBill"].ToString() == "1") || (row["bProductBill"].ToString().ToLower() == "true"))
                    {
                        model.bProductBill = true;
                    }
                    else
                    {
                        model.bProductBill = false;
                    }
                }
                if (row["iCheckATP"] != null && row["iCheckATP"].ToString() != "")
                {
                    model.iCheckATP = int.Parse(row["iCheckATP"].ToString());
                }
                if (row["iInvATPId"] != null && row["iInvATPId"].ToString() != "")
                {
                    model.iInvATPId = int.Parse(row["iInvATPId"].ToString());
                }
                if (row["iPlanTfDay"] != null && row["iPlanTfDay"].ToString() != "")
                {
                    model.iPlanTfDay = int.Parse(row["iPlanTfDay"].ToString());
                }
                if (row["iOverlapDay"] != null && row["iOverlapDay"].ToString() != "")
                {
                    model.iOverlapDay = int.Parse(row["iOverlapDay"].ToString());
                }
                if (row["bPiece"] != null && row["bPiece"].ToString() != "")
                {
                    if ((row["bPiece"].ToString() == "1") || (row["bPiece"].ToString().ToLower() == "true"))
                    {
                        model.bPiece = true;
                    }
                    else
                    {
                        model.bPiece = false;
                    }
                }
                if (row["bSrvItem"] != null && row["bSrvItem"].ToString() != "")
                {
                    if ((row["bSrvItem"].ToString() == "1") || (row["bSrvItem"].ToString().ToLower() == "true"))
                    {
                        model.bSrvItem = true;
                    }
                    else
                    {
                        model.bSrvItem = false;
                    }
                }
                if (row["bSrvFittings"] != null && row["bSrvFittings"].ToString() != "")
                {
                    if ((row["bSrvFittings"].ToString() == "1") || (row["bSrvFittings"].ToString().ToLower() == "true"))
                    {
                        model.bSrvFittings = true;
                    }
                    else
                    {
                        model.bSrvFittings = false;
                    }
                }
                if (row["fMaxSupply"] != null && row["fMaxSupply"].ToString() != "")
                {
                    model.fMaxSupply = decimal.Parse(row["fMaxSupply"].ToString());
                }
                if (row["fMinSplit"] != null && row["fMinSplit"].ToString() != "")
                {
                    model.fMinSplit = decimal.Parse(row["fMinSplit"].ToString());
                }
                if (row["bSpecialOrder"] != null && row["bSpecialOrder"].ToString() != "")
                {
                    if ((row["bSpecialOrder"].ToString() == "1") || (row["bSpecialOrder"].ToString().ToLower() == "true"))
                    {
                        model.bSpecialOrder = true;
                    }
                    else
                    {
                        model.bSpecialOrder = false;
                    }
                }
                if (row["bTrackSaleBill"] != null && row["bTrackSaleBill"].ToString() != "")
                {
                    if ((row["bTrackSaleBill"].ToString() == "1") || (row["bTrackSaleBill"].ToString().ToLower() == "true"))
                    {
                        model.bTrackSaleBill = true;
                    }
                    else
                    {
                        model.bTrackSaleBill = false;
                    }
                }
                if (row["cInvMnemCode"] != null)
                {
                    model.cInvMnemCode = row["cInvMnemCode"].ToString();
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select cInvCode,cInvAddCode,cInvName,cInvStd,cInvCCode,cVenCode,cReplaceItem,cPosition,bSale,bPurchase,bSelf,bComsume,bProducing,bService,bAccessary,iTaxRate,iInvWeight,iVolume,iInvRCost,iInvSPrice,iInvSCost,iInvLSCost,iInvNCost,iInvAdvance,iInvBatch,iSafeNum,iTopSum,iLowSum,iOverStock,cInvABC,bInvQuality,bInvBatch,bInvEntrust,bInvOverStock,dSDate,dEDate,bFree1,bFree2,cInvDefine1,cInvDefine2,cInvDefine3,I_id,bInvType,iInvMPCost,cQuality,iInvSaleCost,iInvSCost1,iInvSCost2,iInvSCost3,bFree3,bFree4,bFree5,bFree6,bFree7,bFree8,bFree9,bFree10,cCreatePerson,cModifyPerson,dModifyDate,fSubscribePoint,fVagQuantity,cValueType,bFixExch,fOutExcess,fInExcess,iMassDate,iWarnDays,fExpensesExch,bTrack,bSerial,bBarCode,iId,cBarCode,cInvDefine4,cInvDefine5,cInvDefine6,cInvDefine7,cInvDefine8,cInvDefine9,cInvDefine10,cInvDefine11,cInvDefine12,cInvDefine13,cInvDefine14,cInvDefine15,cInvDefine16,iGroupType,cGroupCode,cComUnitCode,cAssComUnitCode,cSAComUnitCode,cPUComUnitCode,cSTComUnitCode,cCAComUnitCode,cFrequency,iFrequency,iDays,dLastDate,iWastage,bSolitude,cEnterprise,cAddress,cFile,cLabel,cCheckOut,cLicence,bSpecialties,cDefWareHouse,iHighPrice,iExpSaleRate,cPriceGroup,cOfferGrade,iOfferRate,cMonth,iAdvanceDate,cCurrencyName,cProduceAddress,cProduceNation,cRegisterNo,cEnterNo,cPackingType,cEnglishName,bPropertyCheck,cPreparationType,cCommodity,iRecipeBatch,cNotPatentName,bPromotSales,iPlanPolicy,iROPMethod,iBatchRule,fBatchIncrement,iAssureProvideDays,iTestStyle,iDTMethod,fDTRate,fDTNum,cDTUnit,iDTStyle,iQTMethod,PictureGUID,bPlanInv,bProxyForeign,bATOModel,bCheckItem,bPTOModel,bEquipment,cProductUnit,fOrderUpLimit,cMassUnit,fRetailPrice,cInvDepCode,iAlterAdvance,fAlterBaseNum,cPlanMethod,bMPS,bROP,bRePlan,cSRPolicy,bBillUnite,iSupplyDay,fSupplyMulti,fMinSupply,bCutMantissa,cInvPersonCode,iInvTfId,cEngineerFigNo,bInTotalCost,iSupplyType,bConfigFree1,bConfigFree2,bConfigFree3,bConfigFree4,bConfigFree5,bConfigFree6,bConfigFree7,bConfigFree8,bConfigFree9,bConfigFree10,iDTLevel,cDTAQL,bPeriodDT,cDTPeriod,iBigMonth,iBigDay,iSmallMonth,iSmallDay,bOutInvDT,bBackInvDT,iEndDTStyle,bDTWarnInv,fBackTaxRate,cCIQCode,cWGroupCode,cWUnit,fGrossW,cVGroupCode,cVUnit,fLength,fWidth,fHeight,iDTUCounter,iDTDCounter,iBatchCounter,cShopUnit,cPurPersonCode,bImportMedicine,bFirstBusiMedicine,bForeExpland,cInvPlanCode,fConvertRate,dReplaceDate,bInvModel,bKCCutMantissa,bReceiptByDT,iImpTaxRate,iExpTaxRate,bExpSale,iDrawBatch,bCheckBSATP,cInvProjectCode,iTestRule,cRuleCode,bCheckFree1,bCheckFree2,bCheckFree3,bCheckFree4,bCheckFree5,bCheckFree6,bCheckFree7,bCheckFree8,bCheckFree9,bCheckFree10,bBomMain,bBomSub,bProductBill,iCheckATP,iInvATPId,iPlanTfDay,iOverlapDay,bPiece,bSrvItem,bSrvFittings,fMaxSupply,fMinSplit,bSpecialOrder,bTrackSaleBill,cInvMnemCode ");
            strSql.Append(" FROM Inventory ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" cInvCode,cInvAddCode,cInvName,cInvStd,cInvCCode,cVenCode,cReplaceItem,cPosition,bSale,bPurchase,bSelf,bComsume,bProducing,bService,bAccessary,iTaxRate,iInvWeight,iVolume,iInvRCost,iInvSPrice,iInvSCost,iInvLSCost,iInvNCost,iInvAdvance,iInvBatch,iSafeNum,iTopSum,iLowSum,iOverStock,cInvABC,bInvQuality,bInvBatch,bInvEntrust,bInvOverStock,dSDate,dEDate,bFree1,bFree2,cInvDefine1,cInvDefine2,cInvDefine3,I_id,bInvType,iInvMPCost,cQuality,iInvSaleCost,iInvSCost1,iInvSCost2,iInvSCost3,bFree3,bFree4,bFree5,bFree6,bFree7,bFree8,bFree9,bFree10,cCreatePerson,cModifyPerson,dModifyDate,fSubscribePoint,fVagQuantity,cValueType,bFixExch,fOutExcess,fInExcess,iMassDate,iWarnDays,fExpensesExch,bTrack,bSerial,bBarCode,iId,cBarCode,cInvDefine4,cInvDefine5,cInvDefine6,cInvDefine7,cInvDefine8,cInvDefine9,cInvDefine10,cInvDefine11,cInvDefine12,cInvDefine13,cInvDefine14,cInvDefine15,cInvDefine16,iGroupType,cGroupCode,cComUnitCode,cAssComUnitCode,cSAComUnitCode,cPUComUnitCode,cSTComUnitCode,cCAComUnitCode,cFrequency,iFrequency,iDays,dLastDate,iWastage,bSolitude,cEnterprise,cAddress,cFile,cLabel,cCheckOut,cLicence,bSpecialties,cDefWareHouse,iHighPrice,iExpSaleRate,cPriceGroup,cOfferGrade,iOfferRate,cMonth,iAdvanceDate,cCurrencyName,cProduceAddress,cProduceNation,cRegisterNo,cEnterNo,cPackingType,cEnglishName,bPropertyCheck,cPreparationType,cCommodity,iRecipeBatch,cNotPatentName,bPromotSales,iPlanPolicy,iROPMethod,iBatchRule,fBatchIncrement,iAssureProvideDays,iTestStyle,iDTMethod,fDTRate,fDTNum,cDTUnit,iDTStyle,iQTMethod,PictureGUID,bPlanInv,bProxyForeign,bATOModel,bCheckItem,bPTOModel,bEquipment,cProductUnit,fOrderUpLimit,cMassUnit,fRetailPrice,cInvDepCode,iAlterAdvance,fAlterBaseNum,cPlanMethod,bMPS,bROP,bRePlan,cSRPolicy,bBillUnite,iSupplyDay,fSupplyMulti,fMinSupply,bCutMantissa,cInvPersonCode,iInvTfId,cEngineerFigNo,bInTotalCost,iSupplyType,bConfigFree1,bConfigFree2,bConfigFree3,bConfigFree4,bConfigFree5,bConfigFree6,bConfigFree7,bConfigFree8,bConfigFree9,bConfigFree10,iDTLevel,cDTAQL,bPeriodDT,cDTPeriod,iBigMonth,iBigDay,iSmallMonth,iSmallDay,bOutInvDT,bBackInvDT,iEndDTStyle,bDTWarnInv,fBackTaxRate,cCIQCode,cWGroupCode,cWUnit,fGrossW,cVGroupCode,cVUnit,fLength,fWidth,fHeight,iDTUCounter,iDTDCounter,iBatchCounter,cShopUnit,cPurPersonCode,bImportMedicine,bFirstBusiMedicine,bForeExpland,cInvPlanCode,fConvertRate,dReplaceDate,bInvModel,bKCCutMantissa,bReceiptByDT,iImpTaxRate,iExpTaxRate,bExpSale,iDrawBatch,bCheckBSATP,cInvProjectCode,iTestRule,cRuleCode,bCheckFree1,bCheckFree2,bCheckFree3,bCheckFree4,bCheckFree5,bCheckFree6,bCheckFree7,bCheckFree8,bCheckFree9,bCheckFree10,bBomMain,bBomSub,bProductBill,iCheckATP,iInvATPId,iPlanTfDay,iOverlapDay,bPiece,bSrvItem,bSrvFittings,fMaxSupply,fMinSplit,bSpecialOrder,bTrackSaleBill,cInvMnemCode ");
            strSql.Append(" FROM Inventory ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM Inventory ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.cInvCode desc");
            }
            strSql.Append(")AS Row, T.*  from Inventory T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "Inventory";
			parameters[1].Value = "cInvCode";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}

